method

[]

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveSupport::HashWithIndifferentAccess
[](key) public

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
Show source
Register or log in to add new notes.