From a4bb195c91fa9bb25e136aa8850f3acafea0a597 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lucas=20H=C3=BAngaro?= <lucashungaro@gmail.com>
Date: Sun, 29 Apr 2012 15:43:06 -0300
Subject: Adding deep versions of stringify_keys and symbolize_keys (plain and
 bang) for nested hashes

---
 guides/source/active_support_core_extensions.textile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'guides/source/active_support_core_extensions.textile')

diff --git a/guides/source/active_support_core_extensions.textile b/guides/source/active_support_core_extensions.textile
index 1f92d9d5f5..e2118e8f61 100644
--- a/guides/source/active_support_core_extensions.textile
+++ b/guides/source/active_support_core_extensions.textile
@@ -2611,6 +2611,13 @@ The second line can safely access the "type" key, and let the user to pass eithe
 
 There's also the bang variant +stringify_keys!+ that stringifies keys in the very receiver.
 
+Besides that, one can use +deep_stringify_keys+ and +deep_stringify_keys!+ to stringify all the keys in the given hash and all the hashes nested into it. An example of the result is:
+
+<ruby>
+{nil => nil, 1 => 1, :nested => {:a => 3, 5 => 5}}.deep_stringify_keys
+# => {""=>nil, "1"=>1, "nested"=>{"a"=>3, "5"=>5}}
+</ruby>
+
 NOTE: Defined in +active_support/core_ext/hash/keys.rb+.
 
 h5. +symbolize_keys+ and +symbolize_keys!+
@@ -2645,6 +2652,13 @@ The second line can safely access the +:params+ key, and let the user to pass ei
 
 There's also the bang variant +symbolize_keys!+ that symbolizes keys in the very receiver.
 
+Besides that, one can use +deep_symbolize_keys+ and +deep_symbolize_keys!+ to symbolize all the keys in the given hash and all the hashes nested into it. An example of the result is:
+
+<ruby>
+{nil => nil, 1 => 1, "nested" => {"a" => 3, 5 => 5}}.deep_symbolize_keys
+# => {nil=>nil, 1=>1, :nested=>{:a=>3, 5=>5}}
+</ruby>
+
 NOTE: Defined in +active_support/core_ext/hash/keys.rb+.
 
 h5. +to_options+ and +to_options!+
-- 
cgit v1.2.3

