aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Orenstein <ben.orenstein@gmail.com>2011-02-26 12:59:27 -0500
committerBen Orenstein <ben.orenstein@gmail.com>2011-02-26 12:59:27 -0500
commit8270dcd12e2892147002b23e80e3a25ab45a1e25 (patch)
treed41f519af831e8e180ca726ae775876109bcf4a9
parent6de3f1fb4e3160d0ab8f986ebe9287ce1a19aab0 (diff)
downloadrails-8270dcd12e2892147002b23e80e3a25ab45a1e25.tar.gz
rails-8270dcd12e2892147002b23e80e3a25ab45a1e25.tar.bz2
rails-8270dcd12e2892147002b23e80e3a25ab45a1e25.zip
Correct example that did not do what it claimed. Rework explanation.
-rw-r--r--activesupport/lib/active_support/core_ext/hash/reverse_merge.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb
index a82cdfc360..87a7bebd7b 100644
--- a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb
+++ b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb
@@ -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