Ruby/Hash/update
Материал из Wiki.crossplatform.ru
Версия от 17:57, 13 сентября 2010; ViGOur (Обсуждение | вклад)
update is a synonym for merge!
h = {a:1,b:2} # Using Ruby 1.9 syntax and omitting braces h.update(b:4,c:9) {|key,old,new| old } # h is now {a:1, b:2, c:9} h.update(b:4,c:9) # h is now {a:1, b:4, c:9}