add key and value to first spot in hash ruby
hash1 = { two: 2, three: 3 } #add a new key,value hash1 = Hash[:one,1].merge!(hash1) #=> {:one=>1, :two=>2, :three=>3}
Source: stackoverflow.com
hash1 = { two: 2, three: 3 } #add a new key,value hash1 = Hash[:one,1].merge!(hash1) #=> {:one=>1, :two=>2, :three=>3}