I would like to know if ruby has a builtin method to do the following.
from this array:
array = [:foo, :bar]
and this method:
def content_for_key key
return :baz if key == :foo
return :qux if key == :bar
end
and this call:
array.some_built_in_ruby_method(&:content_for_key)
we get:
{
:foo => :baz,
:bar => :qux,
}
content_for_keyreturnsnilfor anything other than:bar, so what is the logic to build the result? Any timecontent_for_keyreturnsnil, we map that to:baz?