mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Overrode Hash#nested_under_indifferent_access in HashWithIndifferentAccess
to return self.
This commit is contained in:
@@ -16,6 +16,10 @@ module ActiveSupport
|
||||
dup
|
||||
end
|
||||
|
||||
def nested_under_indifferent_access
|
||||
self
|
||||
end
|
||||
|
||||
def initialize(constructor = {})
|
||||
if constructor.is_a?(Hash)
|
||||
super()
|
||||
|
||||
@@ -121,6 +121,9 @@ class HashExtTest < Test::Unit::TestCase
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user