Created
August 9, 2018 20:00
-
-
Save vedant1811/806e8f50cd6a2cff7c55e2eb8a034667 to your computer and use it in GitHub Desktop.
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
def flatten_array(array) | |
result = [] | |
array.each do |e| | |
if e.is_a? Array | |
result += flatten_array e | |
else | |
result << e | |
end | |
end | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment