Skip to content

Instantly share code, notes, and snippets.

@cernanb
Created September 13, 2016 08:19
Show Gist options
  • Save cernanb/3ab6b2f9c368852eb0773f2893afa493 to your computer and use it in GitHub Desktop.
Save cernanb/3ab6b2f9c368852eb0773f2893afa493 to your computer and use it in GitHub Desktop.
Flatten a nested array of integers in Ruby
def flatten_array(array)
array.join(",").split(",").map {|el| el.to_i}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment