aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-08-16 11:06:40 -0700
committerXavier Noria <fxn@hashref.com>2011-08-16 11:06:40 -0700
commit0245792c833c8b13fe53f8ae9f477b63dab928b6 (patch)
tree5b87fcfd31d9189647d06caa6444e36bdcda32ac /activesupport/lib/active_support
parentd0d25a9317aaea794f30e067e9388fe4e08bcde5 (diff)
parentc5f97b5063d1d60341f9e984f29a3b9812fb4c7e (diff)
downloadrails-0245792c833c8b13fe53f8ae9f477b63dab928b6.tar.gz
rails-0245792c833c8b13fe53f8ae9f477b63dab928b6.tar.bz2
rails-0245792c833c8b13fe53f8ae9f477b63dab928b6.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/slice.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb
index d7fb2da0fb..0484d8e5d8 100644
--- a/activesupport/lib/active_support/core_ext/hash/slice.rb
+++ b/activesupport/lib/active_support/core_ext/hash/slice.rb
@@ -30,6 +30,8 @@ class Hash
omit
end
+ # Removes and returns the key/value pairs matching the given keys.
+ # {:a => 1, :b => 2, :c => 3, :d => 4}.extract!(:a, :b) # => {:a => 1, :b => 2}
def extract!(*keys)
result = {}
keys.each {|key| result[key] = delete(key) }