Class: Orange::DefaultHash

Inherits:
Hash show all
Defined in:
lib/orange-core/magick.rb

Overview

Class that extends hash so that [] can have an optional second attribute

Instance Method Summary collapse

Methods inherited from Hash

#with_defaults, #with_defaults!

Instance Method Details

#[](key, my_default = nil) ⇒ Object



129
130
131
132
# File 'lib/orange-core/magick.rb', line 129

def [](key, my_default = nil)
  my_default = self.default if my_default.nil?
  self.has_key?(key) ? super(key) : my_default
end