aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/hash/except.rb
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-01-19 21:05:37 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-01-19 21:05:37 +1100
commit2107921000f4a186fed36e676d1ac089c8be1f99 (patch)
tree42f2188f058f8401d57f0d4c72063689a93e0419 /activesupport/lib/active_support/core_ext/hash/except.rb
parentccb7d9def3c20037c9ed5989d8cae1ed68763f4f (diff)
parented8501ef16fb2f5e4bd4d987740f5e5f62978400 (diff)
downloadrails-2107921000f4a186fed36e676d1ac089c8be1f99.tar.gz
rails-2107921000f4a186fed36e676d1ac089c8be1f99.tar.bz2
rails-2107921000f4a186fed36e676d1ac089c8be1f99.zip
Merge branch 'master' of git://github.com/rails/rails into rails
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/except.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/except.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/except.rb b/activesupport/lib/active_support/core_ext/hash/except.rb
index 6d04cb5621..207801d3a7 100644
--- a/activesupport/lib/active_support/core_ext/hash/except.rb
+++ b/activesupport/lib/active_support/core_ext/hash/except.rb
@@ -3,6 +3,14 @@ class Hash
# limiting a set of parameters to everything but a few known toggles:
#
# @person.update_attributes(params[:person].except(:admin))
+ #
+ # If the receiver responds to +convert_key+, the method is called on each of the
+ # arguments. This allows +except+ to play nice with hashes with indifferent access
+ # for instance:
+ #
+ # {:a => 1}.with_indifferent_access.except(:a) # => {}
+ # {:a => 1}.with_indifferent_access.except("a") # => {}
+ #
def except(*keys)
dup.except!(*keys)
end