提交 8270dcd1 编写于 作者: B Ben Orenstein

Correct example that did not do what it claimed. Rework explanation.

上级 6de3f1fb
......@@ -6,14 +6,14 @@ class Hash
# options.reverse_merge! :size => 25, :velocity => 10
# end
#
# Using <tt>merge</tt>, the above example would look as follows:
# The default <tt>:size</tt> and <tt>:velocity</tt> are only set if the +options+ hash passed in doesn't already
# have the respective key.
#
# As contrast, using Ruby's built in <tt>merge</tt> would require writing the following:
#
# def setup(options = {})
# { :size => 25, :velocity => 10 }.merge(options)
# options = { :size => 25, :velocity => 10 }.merge(options)
# end
#
# The default <tt>:size</tt> and <tt>:velocity</tt> are only set if the +options+ hash passed in doesn't already
# have the respective key.
def reverse_merge(other_hash)
other_hash.merge(self)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册