Method: Settingslogic#method_missing
- Defined in:
- lib/settingslogic.rb
#method_missing(name, *args, &block) ⇒ Object
Called for dynamically-defined keys, and also the first key deferenced at the top-level, if load! is not used. Otherwise, create_accessors! (called by new) will have created actual methods for each key.
114 115 116 117 118 119 120 |
# File 'lib/settingslogic.rb', line 114 def method_missing(name, *args, &block) key = name.to_s return missing_key("Missing setting '#{key}' in #{@section}") unless has_key? key value = fetch(key) create_accessor_for(key) value.is_a?(Hash) ? self.class.new(value, "'#{key}' section in #{@section}") : value end |