From 8270dcd12e2892147002b23e80e3a25ab45a1e25 Mon Sep 17 00:00:00 2001 From: Ben Orenstein Date: Sat, 26 Feb 2011 12:59:27 -0500 Subject: Correct example that did not do what it claimed. Rework explanation. --- .../lib/active_support/core_ext/hash/reverse_merge.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/hash/reverse_merge.rb') 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 merge, the above example would look as follows: + # The default :size and :velocity are only set if the +options+ hash passed in doesn't already + # have the respective key. + # + # As contrast, using Ruby's built in merge would require writing the following: # # def setup(options = {}) - # { :size => 25, :velocity => 10 }.merge(options) + # options = { :size => 25, :velocity => 10 }.merge(options) # end - # - # The default :size and :velocity 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 -- cgit v1.2.3