Comment Comment by faitswulff My favorite little-known fact about Ruby hashes is that they respond to `to_proc` and can be used as procs. For example, you can do this:a = { 1 => 'a', 2 => 'b' }[1, 2, 3].map(&a)#=> ['a', 'b', nil] parent faitswulff 3 years ago
a = { 1 => 'a', 2 => 'b' }
[1, 2, 3].map(&a)
#=> ['a', 'b', nil]