Skip to content

Instantly share code, notes, and snippets.

@breinz
Created February 26, 2014 15:56
Show Gist options
  • Save breinz/9232305 to your computer and use it in GitHub Desktop.
Save breinz/9232305 to your computer and use it in GitHub Desktop.
def all_children(include_self=true)
ar = []
add_children ar, self, include_self
ar
end
def add_children(ar, g, save=true)
ar << g if save
g.children.each{ |c| c.add_children ar, c }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment