Skip to content

Instantly share code, notes, and snippets.

View boborbt's full-sized avatar

Roberto Esposito boborbt

View GitHub Profile
@blambeau
blambeau / destr.rb
Created November 22, 2011 09:00
Fun destructuring in Ruby 1.9
class Hash
def with(&block)
block.call *block.parameters.map{|x| self[x.last]}
end
end
# Example
h = {:name => "blambeau", :hobby => "ruby"}