From 0920e69244026ec83471bb4571e56300045307d3 Mon Sep 17 00:00:00 2001 From: Lourens Naude Date: Sun, 12 Jul 2009 12:18:04 +0100 Subject: ActiveSupport Hash optimizations [#2902 state:resolved] Signed-off-by: Carl Lerche --- activesupport/lib/active_support/hash_with_indifferent_access.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/hash_with_indifferent_access.rb') diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 61fc6475a0..543dab4a75 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -98,6 +98,10 @@ module ActiveSupport super other_hash.with_indifferent_access end + def reverse_merge!(other_hash) + replace(reverse_merge( other_hash )) + end + # Removes a specified key from the hash. def delete(key) super(convert_key(key)) @@ -109,7 +113,7 @@ module ActiveSupport # Convert to a Hash with String keys. def to_hash - Hash.new(default).merge(self) + Hash.new(default).merge!(self) end protected -- cgit v1.2.3