Created
April 20, 2018 09:27
-
-
Save dukeimg/c34c0e0e41359654ce01f034bfbe7d97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten(input, output = []) | |
input.each do |el| | |
if el.is_a? Array | |
flatten(el, output) | |
else | |
output << el | |
end | |
end | |
output | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment