method

assoc

Importance_1
v6.1.7.7 - Show latest stable - 0 notes - Class: ActiveSupport::HashWithIndifferentAccess
assoc(key) public

Same as Hash#assoc where the key passed as argument can be either a string or a symbol:

counters = ActiveSupport::HashWithIndifferentAccess.new
counters[:foo] = 1

counters.assoc('foo') # => ["foo", 1]
counters.assoc(:foo)  # => ["foo", 1]
counters.assoc(:zoo)  # => nil
Show source
Register or log in to add new notes.