Skip to content

Instantly share code, notes, and snippets.

@davidcelis
Created July 20, 2012 21:02
Show Gist options
  • Save davidcelis/3153192 to your computer and use it in GitHub Desktop.
Save davidcelis/3153192 to your computer and use it in GitHub Desktop.
How to refer to other elements in the same hash
hash = {
:before => "Hello",
:after => "world!",
:ref => lambda { hash[:before] << ' ' << hash[:after] }
}
hash[:ref].call # => "Hello world!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment