Class: Voom::Presenters::DSL::Components::Select
- Defined in:
- lib/voom/presenters/dsl/components/select.rb
Defined Under Namespace
Classes: Option
Instance Attribute Summary collapse
-
#full_width ⇒ Object
readonly
Returns the value of attribute full_width.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Attributes inherited from Input
Attributes inherited from EventBase
Attributes included from Mixins::Event
Attributes inherited from Base
#attributes, #context, #id, #type
Instance Method Summary collapse
- #icon(icon = nil, **attribs, &block) ⇒ Object
-
#initialize(**attribs_, &block) ⇒ Select
constructor
A new instance of Select.
- #label(text = nil) ⇒ Object
- #option(**attribs, &block) ⇒ Object
Methods included from Mixins::Tooltips
Methods included from Mixins::Event
Methods inherited from Base
Methods included from Mixins::YieldTo
Methods included from Serializer
Methods included from Lockable
Constructor Details
#initialize(**attribs_, &block) ⇒ Select
Returns a new instance of Select.
11 12 13 14 15 16 17 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 11 def initialize(**attribs_, &block) super(type: :select, **attribs_, &block) @required = attribs.delete(:required) @full_width = attribs.delete(:full_width) || true @options = [] end |
Instance Attribute Details
#full_width ⇒ Object (readonly)
Returns the value of attribute full_width.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 9 def full_width @full_width end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 9 def @options end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
9 10 11 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 9 def required @required end |
Instance Method Details
#icon(icon = nil, **attribs, &block) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 24 def icon(icon=nil, **attribs, &block) return @icon if locked? @icon = Components::Icon.new(parent: self, icon: icon, context: context, **attribs, &block) end |
#label(text = nil) ⇒ Object
19 20 21 22 |
# File 'lib/voom/presenters/dsl/components/select.rb', line 19 def label(text=nil) return @label if locked? @label = text end |