Skip to content

Instantly share code, notes, and snippets.

@jdkealy
Created October 2, 2011 20:37
Show Gist options
  • Save jdkealy/1257907 to your computer and use it in GitHub Desktop.
Save jdkealy/1257907 to your computer and use it in GitHub Desktop.
def all_children(x=1)
all = []
self.children.each do |f|
all << f
if x < 3 then
root_children = f.all_children(x).flatten
all << root_children unless root_children.empty?
x = x + 1
end
end
return all.flatten
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment