Method: Ardm::Mash#default

Defined in:
lib/ardm/support/mash.rb

#default(key = nil) ⇒ Object

Gets the default value for the mash.

Parameters:

  • key (Object) (defaults to: nil)

    The default value for the mash. If key is a Symbol and it is a key in the mash, then the default value will be set to the value matching the key.



27
28
29
30
31
32
33
# File 'lib/ardm/support/mash.rb', line 27

def default(key = nil)
  if key.is_a?(Symbol) && include?(key = key.to_s)
    self[key]
  else
    super
  end
end