Skip to content

Instantly share code, notes, and snippets.

@shawnpk
Created July 9, 2019 21:13
Show Gist options
  • Select an option

  • Save shawnpk/8a99523462ab47906cb0c5cba5416c92 to your computer and use it in GitHub Desktop.

Select an option

Save shawnpk/8a99523462ab47906cb0c5cba5416c92 to your computer and use it in GitHub Desktop.
def recursive_array_flatten(array, results = [])
array.each do |element|
if element.class == Array
recursive_flatten(element, results)
else
results << element
end
end
results
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment