提交 6d19a4a6 编写于 作者: S Santiago Pastorino 提交者: Xavier Noria

Change implementation to do it without asking each time for block_given?

Signed-off-by: NXavier Noria <fxn@hashref.com>
上级 36143d26
......@@ -130,12 +130,10 @@ def shift
end
def merge!(other_hash)
other_hash.each do |k, v|
if block_given? && key?(k)
self[k] = yield k, self[k], v
else
self[k] = v
end
if block_given?
other_hash.each { |k, v| self[k] = key?(k) ? yield(k, self[k], v) : v }
else
other_hash.each { |k, v| self[k] = v }
end
self
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册