Class: Setting
- Inherits:
-
Object
- Object
- Setting
- Defined in:
- lib/rsettings/core/setting.rb
Instance Method Summary collapse
-
#initialize(text = "") ⇒ Setting
constructor
A new instance of Setting.
- #missing? ⇒ Boolean
- #to_s ⇒ Object
- #true? ⇒ Boolean
- #truthy? ⇒ Boolean
Constructor Details
#initialize(text = "") ⇒ Setting
Returns a new instance of Setting.
4 5 6 7 |
# File 'lib/rsettings/core/setting.rb', line 4 def initialize(text="") @text = text @truthy = (text||"").downcase.match /(yes|no|on|off)/ end |
Instance Method Details
#missing? ⇒ Boolean
9 |
# File 'lib/rsettings/core/setting.rb', line 9 def missing?; @text.nil?; end |
#to_s ⇒ Object
11 |
# File 'lib/rsettings/core/setting.rb', line 11 def to_s; @text.to_s; end |
#true? ⇒ Boolean
13 14 15 16 |
# File 'lib/rsettings/core/setting.rb', line 13 def true? match = (@text||"").downcase.match(/(yes|on)/) false == match.nil? end |
#truthy? ⇒ Boolean
2 |
# File 'lib/rsettings/core/setting.rb', line 2 def truthy?; @truthy; end |