Answers for "apply a function to all values of a hash ruby"

0

ruby map hash

hash = { bacon: "protein", apple: "fruit" }

hash.map { |k,v| [k, v.to_sym] }.to_h
# {:bacon=>:protein, :apple=>:fruit}
Posted by: Guest on August-26-2020

Code answers related to "apply a function to all values of a hash ruby"

Browse Popular Code Answers by Language