Class: SettingsStore::SettingsHash

Inherits:
ActiveSupport::OrderedOptions
  • Object
show all
Defined in:
lib/settings_store.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/settings_store.rb', line 16

def method_missing(name, *args)
  if name.to_s =~ /(.*)=$/
    super
  elsif self.include? name
    self[name]
  else
    raise NoSettingError, "subsetting #{name} is not present; check spelling or set it"
  end
end

Instance Method Details

#respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
# File 'lib/settings_store.rb', line 8

def respond_to?(name)
  if name.to_s =~ /(.*)=$/
    super
  else
    self.include? name
  end
end