Skip to content

Instantly share code, notes, and snippets.

@vedant1811
Created August 9, 2018 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vedant1811/806e8f50cd6a2cff7c55e2eb8a034667 to your computer and use it in GitHub Desktop.
Save vedant1811/806e8f50cd6a2cff7c55e2eb8a034667 to your computer and use it in GitHub Desktop.
def flatten_array(array)
result = []
array.each do |e|
if e.is_a? Array
result += flatten_array e
else
result << e
end
end
result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment