method
assoc
v5.2.3 -
Show latest stable
- 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