aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorSebastian Martinez <sebastian@wyeworks.com>2011-08-15 20:20:28 -0300
committerSebastian Martinez <sebastian@wyeworks.com>2011-08-15 20:20:28 -0300
commit308595739c32609ac5b167ecdc6cb6cb4ec6c81f (patch)
treeae53554d3aae8eaced3a28e3986cad13b5435067 /railties
parent583d7c15c301f15f1e997a06e15b55a2e7bf794f (diff)
downloadrails-308595739c32609ac5b167ecdc6cb6cb4ec6c81f.tar.gz
rails-308595739c32609ac5b167ecdc6cb6cb4ec6c81f.tar.bz2
rails-308595739c32609ac5b167ecdc6cb6cb4ec6c81f.zip
Document Hash#extract!.
Diffstat (limited to 'railties')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile12
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index 781d3d08cd..a672b17e4a 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -2696,6 +2696,18 @@ hash # => {:a => 1}
NOTE: Defined in +active_support/core_ext/hash/slice.rb+.
+h4. Extracting
+
+The method +extract!+ removes and returns the key/value pairs matching the given keys.
+
+<ruby>
+hash = {:a => 1, :b => 2}
+rest = hash.extract!(:a) # => {:a => 1}
+hash # => {:b => 2}
+</ruby>
+
+NOTE: Defined in +active_support/core_ext/hash/slice.rb+.
+
h4. Indifferent Access
The method +with_indifferent_access+ returns an +ActiveSupport::HashWithIndifferentAccess+ out of its receiver: