Class: Formidable::Elements::Option
- Inherits:
-
Element
- Object
- BasicElement
- Element
- Formidable::Elements::Option
- Defined in:
- lib/formidable/elements.rb
Constant Summary
Constants included from Coercions
Coercions::IncompatibleInterface, Coercions::MissingCoercion
Constants included from Rendering
Rendering::RendererNotAssigned
Instance Attribute Summary
Attributes inherited from BasicElement
#attributes, #content, #name, #tag
Attributes included from Rendering
Instance Method Summary collapse
- #cleaned_data ⇒ Object
-
#initialize(value, attributes = Hash.new, &block) ⇒ Option
constructor
A new instance of Option.
- #raw_data ⇒ Object
Methods included from Coercions
#coerce, #coerce!, #coercions, coercions, included
Methods included from Validations
#errors, register_validation, #valid?, #validate, #validations
Methods included from Rendering
Constructor Details
#initialize(value, attributes = Hash.new, &block) ⇒ Option
Returns a new instance of Option.
310 311 312 313 |
# File 'lib/formidable/elements.rb', line 310 def initialize(value, attributes = Hash.new, &block) self.content = block.call super(:option, nil, attributes.merge!(value: value)) end |
Instance Method Details
#cleaned_data ⇒ Object
319 320 321 |
# File 'lib/formidable/elements.rb', line 319 def cleaned_data @cleaned_data ||= self.raw_data end |
#raw_data ⇒ Object
315 316 317 |
# File 'lib/formidable/elements.rb', line 315 def raw_data @raw_data ||= self.attributes[:value] end |