Last active
July 6, 2017 13:27
-
-
Save moeabdol/e20599451b861a6585a103f5d72560e5 to your computer and use it in GitHub Desktop.
flatten arbitrarily nested array
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
# This method should return [1, 2, 3, 4] | |
a = [[1, 2, [3]], 4] | |
eval "[#{a.to_s.delete('[]')}]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment