Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hash to_proc demo
hash = {foo: 1, bar: 2, buzz: 10}
words = %i(foo bar buzz)
p words.map(&hash) # => [1, 2, 10]
proc_obj = hash.method(:[]).to_proc
p words.map(&proc_obj) # => [1, 2, 10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.