Answers for "ruby merge multiple hashes"

3

ruby merge array of hashes into one hash

a.reduce Hash.new, :merge
Posted by: Guest on July-31-2020
2

ruby merge array of hashes into one hash

a.inject(:merge)
#=> {:a=>:b, :c=>:d}
Posted by: Guest on July-31-2020
0

how to add two variables into a hash ruby

your_hash = {}
hash_key = gets.chomp
hash_value = gets.chomp
your_hash[hash_key] = hash_value
Posted by: Guest on October-07-2020

Browse Popular Code Answers by Language