Skip to content

Instantly share code, notes, and snippets.

@dukeimg
Created April 20, 2018 09:27
Show Gist options
  • Save dukeimg/c34c0e0e41359654ce01f034bfbe7d97 to your computer and use it in GitHub Desktop.
Save dukeimg/c34c0e0e41359654ce01f034bfbe7d97 to your computer and use it in GitHub Desktop.
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