Skip to content

Instantly share code, notes, and snippets.

@moeabdol
Last active July 6, 2017 13:27
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 moeabdol/e20599451b861a6585a103f5d72560e5 to your computer and use it in GitHub Desktop.
Save moeabdol/e20599451b861a6585a103f5d72560e5 to your computer and use it in GitHub Desktop.
flatten arbitrarily nested array
# 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