diff options
author | Ben Orenstein <ben.orenstein@gmail.com> | 2011-02-26 12:59:27 -0500 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-03-05 11:56:30 +0100 |
commit | 4c27ad0c23d8d8889221d5234496b39f1cc9bdb8 (patch) | |
tree | 7ef886d4f5cf0bf897084423579517df898fbfc9 /activesupport | |
parent | feec2250bbb53428ae13ea928c68e378447bef81 (diff) | |
download | rails-4c27ad0c23d8d8889221d5234496b39f1cc9bdb8.tar.gz rails-4c27ad0c23d8d8889221d5234496b39f1cc9bdb8.tar.bz2 rails-4c27ad0c23d8d8889221d5234496b39f1cc9bdb8.zip |
Correct example that did not do what it claimed. Rework explanation.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/reverse_merge.rb | 10 |
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 |