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, #css_class, #draggable, #drop_zone, #id, #tag, #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 Pluggable
#include_plugins, #plugin, #plugin_module
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ Option
Returns a new instance of Option.
47 48 49 50 51 52 53 54 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 47 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.
45 46 47 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 45 def disabled @disabled end |
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
45 46 47 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 45 def selected @selected end |
Instance Method Details
#text(text = nil) ⇒ Object
61 62 63 64 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 61 def text(text=nil) return @text if locked? @text = text end |
#value(value = nil) ⇒ Object
56 57 58 59 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 56 def value(value=nil) return @value if locked? @value = value end |