ruby using the “&:methodname” shortcut from array.map(&:methodname) for hash key strings rather than methodname
You can do this with a lambda: extract_keyname = ->(h) { h[:keyname] } ary_of_hashes.map(&extract_keyname) This tends to be more useful if the block’s logic is more complicated than simply extracting a value from a Hash. Also, attaching names to your bits of logic can help clarify what a chain of Enumerable method calls is trying … Read more