Permalink
Browse files

Merge pull request #3941 from azimux/fix_nested_under_indifferent_access

Overrode Hash#nested_under_indifferent_access in HashWithIndifferentAccess
  • Loading branch information...
2 parents 6887aed + 3d6eafe commit a8f2b203b45bfa34785b3c411079e59f60c52cac @josevalim josevalim committed Dec 11, 2011
@@ -16,6 +16,10 @@ def with_indifferent_access
dup
end
+ def nested_under_indifferent_access
+ self
+ end
+
def initialize(constructor = {})
if constructor.is_a?(Hash)
super()
@@ -121,6 +121,9 @@ def test_nested_under_indifferent_access
foo = { "foo" => NonIndifferentHash.new.tap { |h| h["bar"] = "baz" } }.with_indifferent_access
assert_kind_of NonIndifferentHash, foo["foo"]
+
+ foo = { "foo" => IndifferentHash.new.tap { |h| h["bar"] = "baz" } }.with_indifferent_access
+ assert_kind_of IndifferentHash, foo["foo"]
end
def test_indifferent_assorted

0 comments on commit a8f2b20

Please sign in to comment.