Created
December 30, 2011 17:05
-
-
Save fguillen/1540618 to your computer and use it in GitHub Desktop.
to_hash recursive for HashWithIndifferentAccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HashWithIndifferentAccess < Hash | |
def to_hash_recursive | |
result = self.to_hash | |
result.each do |key, value| | |
if(value.is_a? HashWithIndifferentAccess) | |
result[key] = value.to_hash_recursive | |
end | |
end | |
result | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how about this?