Commit 17eef070 authored by Gilad Zohari's avatar Gilad Zohari

add type check in Hash#merge!

parent 7d134d94
class Hash
def merge!(other, &block)
raise "can't convert argument into Hash" unless other.respond_to?(:to_hash)
if block
other.each_key{|k|
self[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment