Class: Formica::Config::Option
- Inherits:
-
Struct
- Object
- Struct
- Formica::Config::Option
- Defined in:
- lib/formica.rb
Instance Attribute Summary collapse
-
#defined ⇒ Object
Returns the value of attribute defined.
-
#option ⇒ Object
Returns the value of attribute option.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#defined ⇒ Object
Returns the value of attribute defined
29 30 31 |
# File 'lib/formica.rb', line 29 def defined @defined end |
#option ⇒ Object
Returns the value of attribute option
29 30 31 |
# File 'lib/formica.rb', line 29 def option @option end |
#value ⇒ Object
Returns the value of attribute value
29 30 31 |
# File 'lib/formica.rb', line 29 def value @value end |
Instance Method Details
#validate!(value, config) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/formica.rb', line 30 def validate!(value, config) value = option.coerce[value] if option.coerce return value unless option.validate unless instance_exec(value, &option.validate) raise("invalid value #{value.inspect} for option #{option.attr_name} in #{config}") end value end |