Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Overrode Hash#nested_under_indifferent_access in HashWithIndifferentA…

…ccess

to return self.
  • Loading branch information...
commit 3d6eafe32ed498784dba2b9782bbf7df47ebeb6b 1 parent 6887aed
Miles Georgi azimux authored
4 activesupport/lib/active_support/hash_with_indifferent_access.rb
View
@@ -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()
3  activesupport/test/core_ext/hash_ext_test.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.