aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/hash_with_indifferent_access.rb
diff options
context:
space:
mode:
authorMarc Schütz <schuetzm@gmx.net>2013-07-06 11:59:30 +0200
committerMarc Schütz <schuetzm@gmx.net>2013-07-06 15:56:07 +0200
commit20c065594f1434c93e6fe64cad062a0df1f42a8e (patch)
treed56af1342f4e79dde5a1f2328ad2b429d6465e62 /activesupport/lib/active_support/hash_with_indifferent_access.rb
parent01d4941d0c87764742562c59d4bf7bb34ac108c4 (diff)
downloadrails-20c065594f1434c93e6fe64cad062a0df1f42a8e.tar.gz
rails-20c065594f1434c93e6fe64cad062a0df1f42a8e.tar.bz2
rails-20c065594f1434c93e6fe64cad062a0df1f42a8e.zip
Make HashWithIndifferentAccess#select always return the hash.
Hash#select! returns nil if the hash didn't change and thus behaves differently from select, so it's return value can't be used as result for the latter.
Diffstat (limited to 'activesupport/lib/active_support/hash_with_indifferent_access.rb')
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb
index 95e03ba95c..3da99872c0 100644
--- a/activesupport/lib/active_support/hash_with_indifferent_access.rb
+++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -228,7 +228,7 @@ module ActiveSupport
def to_options!; self end
def select(*args, &block)
- dup.select!(*args, &block)
+ dup.tap {|hash| hash.select!(*args, &block)}
end
# Convert to a regular hash with string keys.