Files
mruby-mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb
T
2013-03-22 17:10:42 +09:00

13 lines
247 B
Ruby

class Hash
def merge!(other, &block)
if block
other.each_key{|k|
self[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]
}
else
other.each_key{|k| self[k] = other[k]}
end
self
end
end