class method
self.new
Ruby on Rails 7.0.10
Since v3.0.20Signature
self.new(constructor = nil)
No documentation comment.
Parameters
-
constructoropt = nil
Source
# File activesupport/lib/active_support/hash_with_indifferent_access.rb, line 68
def initialize(constructor = nil)
if constructor.respond_to?(:to_hash)
super()
update(constructor)
hash = constructor.is_a?(Hash) ? constructor : constructor.to_hash
self.default = hash.default if hash.default
self.default_proc = hash.default_proc if hash.default_proc
elsif constructor.nil?
super()
else
super(constructor)
end
end
Defined in activesupport/lib/active_support/hash_with_indifferent_access.rb line 68
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::HashWithIndifferentAccess