Skip to content

Instantly share code, notes, and snippets.

@nhessler
Created June 3, 2011 21:26
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 nhessler/1007197 to your computer and use it in GitHub Desktop.
Save nhessler/1007197 to your computer and use it in GitHub Desktop.
creating a lineage! is it too clever?
[grandpa, father, son,].inject(nil) do |parent, child|
child.parent = parent
child
end
@mikelikesbikes
Copy link

yes. although i'm all about clever uses of inject... like this: https://gist.github.com/1007228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment