Skip to content

Instantly share code, notes, and snippets.

@shotarok
Created June 30, 2013 01:37
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 shotarok/5893421 to your computer and use it in GitHub Desktop.
Save shotarok/5893421 to your computer and use it in GitHub Desktop.
My flatten function !!
def myflatten(ary)
tmp = []
ary.each { |e|
if e.is_a? Array then
tmp.concat myflatten(e)
else
tmp.push e
end
}
return tmp
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment