Class: UltraConfig::Config
- Inherits:
-
Object
- Object
- UltraConfig::Config
- Includes:
- Validation
- Defined in:
- lib/ultra_config/config.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, parents, options = {}, &block) ⇒ Config
constructor
A new instance of Config.
- #sanitize? ⇒ Boolean
- #set(&block) ⇒ Object
- #to_s ⇒ Object
Methods included from Validation
#custom, #match, #one_of, #range, #type_safety
Constructor Details
#initialize(name, parents, options = {}, &block) ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 16 17 18 |
# File 'lib/ultra_config/config.rb', line 10 def initialize(name, parents, = {}, &block) @name = name @parents = parents @config_block = block @value = [:default].nil? ? nil : [:default] @sanitize = [:sanitize] || false @error_msg = [:error_msg] end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/ultra_config/config.rb', line 8 def value @value end |
Instance Method Details
#sanitize? ⇒ Boolean
36 37 38 |
# File 'lib/ultra_config/config.rb', line 36 def sanitize? @sanitize end |
#set(&block) ⇒ Object
32 33 34 |
# File 'lib/ultra_config/config.rb', line 32 def set(&block) @intermediate_value = yield(@intermediate_value) end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/ultra_config/config.rb', line 40 def to_s "\"#{@value.to_s}\"" end |