Class: Voom::Presenters::DSL::Components::Select::Option
- Defined in:
- lib/voom/presenters/dsl/components/select.rb
Instance Attribute Summary collapse
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
Attributes inherited from Base
#attributes, #context, #id, #type
Instance Method Summary collapse
-
#initialize(**attribs_, &block) ⇒ Option
constructor
A new instance of Option.
- #text(text = nil) ⇒ Object
- #value(value = nil) ⇒ Object
Methods inherited from Base
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ Option
Returns a new instance of Option.
40 41 42 43 44 45 46 47 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 40 def initialize(**attribs_, &block) super(type: :select_option, **attribs_, &block) @value = self.value(attribs.delete(:value)) @text = self.text(attribs.delete(:text)) @selected = attribs.delete(:selected) @disabled = attribs.delete(:disabled) end |
Instance Attribute Details
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
38 39 40 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 38 def disabled @disabled end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
38 39 40 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 38 def selected @selected end |
Instance Method Details
#text(text = nil) ⇒ Object
54 55 56 57 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 54 def text(text=nil) return @text if locked? @text = text end |
#value(value = nil) ⇒ Object
49 50 51 52 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 49 def value(value=nil) return @value if locked? @value = value end |