instance method
[]
Ruby on Rails 6.1.7.10
Since v5.2.8.1Signature
[](key)
Same as Hash#[] where the key passed as argument can be either a string or a symbol:
counters = ActiveSupport::HashWithIndifferentAccess.new counters[:foo] = 1 counters['foo'] # => 1 counters[:foo] # => 1 counters[:zoo] # => nil
Parameters
-
keyreq
Source
# File activesupport/lib/active_support/hash_with_indifferent_access.rb, line 164
def [](key)
super(convert_key(key))
end
Defined in activesupport/lib/active_support/hash_with_indifferent_access.rb line 164
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::HashWithIndifferentAccess