Method: Configatron::Store#method_missing

Defined in:
lib/gems/configatron-2.2.2/lib/configatron/store.rb

#method_missing(sym, *args) ⇒ Object

:nodoc:



94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/gems/configatron-2.2.2/lib/configatron/store.rb', line 94

def method_missing(sym, *args) # :nodoc:
  if sym.to_s.match(/(.+)=$/)
    name = sym.to_s.gsub("=", '').to_sym
    raise Configatron::ProtectedParameter.new(name) if @_protected.include?(name) || methods_include?(name)
    raise Configatron::LockedNamespace.new(@_name) if @_locked && !@_store.has_key?(name)
    @_store[name] = parse_options(*args)
  elsif @_store.has_key?(sym)
    return @_store[sym]
  else
    store = Configatron::Store.new({}, sym, self)
    @_store[sym] = store
    return store
  end
end