Class: RSettings
- Inherits:
-
Object
- Object
- RSettings
- Includes:
- Audible
- Defined in:
- lib/rsettings/core/rsettings.rb
Instance Method Summary collapse
- #find(m) ⇒ Object
-
#initialize(opts = {}) ⇒ RSettings
constructor
A new instance of RSettings.
Constructor Details
#initialize(opts = {}) ⇒ RSettings
Returns a new instance of RSettings.
4 5 6 |
# File 'lib/rsettings/core/rsettings.rb', line 4 def initialize(opts={}) @settings,@names = opts[:settings],opts[:names] end |
Instance Method Details
#find(m) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rsettings/core/rsettings.rb', line 8 def find(m) query = m.to_s.end_with? "?" m = m.to_s.delete "?" if query name = ConvertibleSettingName.new(@names, m) if query value = @settings.get(name) fail "Unable to convert setting <#{name.value}> to flag" unless value.truthy? return value.true? end notify :finding, m, name result = @settings.get(name) result.missing? ? nil : result.to_s end |