Created
September 13, 2016 08:19
-
-
Save cernanb/3ab6b2f9c368852eb0773f2893afa493 to your computer and use it in GitHub Desktop.
Flatten a nested array of integers in Ruby
This file contains 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_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