Class: FigTree::ConfigValue
- Inherits:
-
Struct
- Object
- Struct
- FigTree::ConfigValue
- Defined in:
- lib/fig_tree.rb
Instance Attribute Summary collapse
-
#default_proc ⇒ Object
Returns the value of attribute default_proc.
-
#default_value ⇒ Object
Returns the value of attribute default_value.
-
#deprecation ⇒ Object
Returns the value of attribute deprecation.
-
#removed ⇒ Object
Returns the value of attribute removed.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#clone_and_reset ⇒ Object
:nodoc:.
- #default_value? ⇒ Boolean
-
#reset_values ⇒ Object
Reset value back to default.
Instance Attribute Details
#default_proc ⇒ Object
Returns the value of attribute default_proc
19 20 21 |
# File 'lib/fig_tree.rb', line 19 def default_proc @default_proc end |
#default_value ⇒ Object
Returns the value of attribute default_value
19 20 21 |
# File 'lib/fig_tree.rb', line 19 def default_value @default_value end |
#deprecation ⇒ Object
Returns the value of attribute deprecation
19 20 21 |
# File 'lib/fig_tree.rb', line 19 def deprecation @deprecation end |
#removed ⇒ Object
Returns the value of attribute removed
19 20 21 |
# File 'lib/fig_tree.rb', line 19 def removed @removed end |
#value ⇒ Object
Returns the value of attribute value
19 20 21 |
# File 'lib/fig_tree.rb', line 19 def value @value end |
Instance Method Details
#clone_and_reset ⇒ Object
:nodoc:
31 32 33 34 35 36 37 |
# File 'lib/fig_tree.rb', line 31 def clone_and_reset val = self.value.respond_to?(:clone_and_reset) ? self.value.clone_and_reset : self.value setting = ConfigValue.new(val, self.default_value, self.default_proc, self.deprecation) setting.reset_values setting end |
#default_value? ⇒ Boolean
40 41 42 43 |
# File 'lib/fig_tree.rb', line 40 def default_value? val = self.default_proc ? self.default_proc.call : self.default_value val == self.value end |
#reset_values ⇒ Object
Reset value back to default.
22 23 24 25 26 27 28 |
# File 'lib/fig_tree.rb', line 22 def reset_values if self.value.is_a?(ConfigStruct) self.value.reset_values else self.value = self.default_value end end |