提交 0bd668fd 编写于 作者: J Jeremy Kemper

Namespace HashWithIndifferentAccess

上级 2133044f
......@@ -2,7 +2,7 @@
class Hash
def with_indifferent_access
hash = HashWithIndifferentAccess.new(self)
hash = ActiveSupport::HashWithIndifferentAccess.new(self)
hash.default = self.default
hash
end
......
......@@ -2,7 +2,8 @@
# people can write params[:key] instead of params['key']
# and they get the same value for both keys.
class HashWithIndifferentAccess < Hash
module ActiveSupport
class HashWithIndifferentAccess < Hash
def initialize(constructor = {})
if constructor.is_a?(Hash)
super()
......@@ -126,4 +127,7 @@ def convert_value(value)
value
end
end
end
end
HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册