Permalink
Browse files

Merge pull request #54 from dmitriybudnik/master

KeyConversion modules kinda mixed up
  • Loading branch information...
2 parents 8dd0fec + 0db4eaa commit 7055ae62352b7104dc2e7f50f1616f1b040b68b6 @jch jch committed Oct 15, 2012
Showing with 19 additions and 17 deletions.
  1. +19 −17 lib/hashie/extensions/key_conversion.rb
@@ -20,6 +20,25 @@ def stringify_keys!
def stringify_keys
dup.stringify_keys!
end
+
+ protected
+
+ # Stringify all keys recursively within nested
+ # hashes and arrays.
+ def stringify_keys_recursively!(object)
+ if self.class === object
+ object.stringify_keys!
+ elsif ::Array === object
+ object.each do |i|
+ stringify_keys_recursively!(i)
+ end
+ object
+ elsif object.respond_to?(:stringify_keys!)
+ object.stringify_keys!
+ else
+ object
+ end
+ end
end
module SymbolizeKeys
@@ -45,23 +64,6 @@ def symbolize_keys
protected
- # Stringify all keys recursively within nested
- # hashes and arrays.
- def stringify_keys_recursively!(object)
- if self.class === object
- object.stringify_keys!
- elsif ::Array === object
- object.each do |i|
- stringify_keys_recursively!(i)
- end
- object
- elsif object.respond_to?(:stringify_keys!)
- object.stringify_keys!
- else
- object
- end
- end
-
# Symbolize all keys recursively within nested
# hashes and arrays.
def symbolize_keys_recursively!(object)

0 comments on commit 7055ae6

Please sign in to comment.