method
default
v6.0.0 -
Show latest stable
- Class:
ActiveSupport::HashWithIndifferentAccess
default(*args)public
Same as Hash#default where the key passed as argument can be either a string or a symbol:
hash = ActiveSupport::HashWithIndifferentAccess.new(1) hash.default # => 1 hash = ActiveSupport::HashWithIndifferentAccess.new { |hash, key| key } hash.default # => nil hash.default('foo') # => 'foo' hash.default(:foo) # => 'foo'