Skip to content

Instantly share code, notes, and snippets.

@moro
Created October 20, 2011 11:52
Show Gist options
  • Save moro/1300961 to your computer and use it in GitHub Desktop.
Save moro/1300961 to your computer and use it in GitHub Desktop.
class Array
def to_proc
m, args = self
lambda {|x| x.send(m.to_sym, *args) }
end
end
p [{:a => 1}].find(&[:key?, :a]) #=> {:a => 1}
p [{:a => 1}].find(&[:key?, :b]) #=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment