diff options
author | Lourens Naude <lourens@methodmissing.com> | 2009-07-12 12:18:04 +0100 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2009-07-15 13:23:05 -0700 |
commit | 0920e69244026ec83471bb4571e56300045307d3 (patch) | |
tree | ea58042cd42a3fdad8ab90f6ea6149ba9e104e2b /activesupport/lib/active_support/core_ext/hash/diff.rb | |
parent | 40b387580ff251e06632fbcc87c2a78c027a6b27 (diff) | |
download | rails-0920e69244026ec83471bb4571e56300045307d3.tar.gz rails-0920e69244026ec83471bb4571e56300045307d3.tar.bz2 rails-0920e69244026ec83471bb4571e56300045307d3.zip |
ActiveSupport Hash optimizations [#2902 state:resolved]
Signed-off-by: Carl Lerche <carllerche@mac.com>
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/diff.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/diff.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/diff.rb b/activesupport/lib/active_support/core_ext/hash/diff.rb index da98593458..b904f49fa8 100644 --- a/activesupport/lib/active_support/core_ext/hash/diff.rb +++ b/activesupport/lib/active_support/core_ext/hash/diff.rb @@ -8,6 +8,6 @@ class Hash # {}.diff(1 => 2) # => {1 => 2} # {1 => 2, 3 => 4}.diff(1 => 2) # => {3 => 4} def diff(h2) - dup.delete_if { |k, v| h2[k] == v }.merge(h2.dup.delete_if { |k, v| has_key?(k) }) + dup.delete_if { |k, v| h2[k] == v }.merge!(h2.dup.delete_if { |k, v| has_key?(k) }) end end |