class Voom::Presenters::DSL::Components::Select
Attributes
full_width[R]
options[R]
outlined[R]
required[R]
Public Class Methods
new(**attribs_, &block)
click to toggle source
Calls superclass method
Voom::Presenters::DSL::Components::Input::new
# File lib/voom/presenters/dsl/components/select.rb, line 9 def initialize(**attribs_, &block) super(type: :select, **attribs_, &block) @required = attribs.delete(:required) @full_width = attribs.delete(:full_width){ true } @outlined = attribs.delete(:outlined){ true } @options = [] expand! end
Public Instance Methods
hint(hint=nil)
click to toggle source
# File lib/voom/presenters/dsl/components/select.rb, line 33 def hint(hint=nil) return @hint if locked? @hint = hint end
icon(icon=nil, **attribs, &block)
click to toggle source
# File lib/voom/presenters/dsl/components/select.rb, line 38 def icon(icon=nil, **attribs, &block) return @icon if locked? @icon = Components::Icon.new(parent: self, icon: icon, position: attribs.delete(:position){:right}, **attribs, &block) end
label(text=nil)
click to toggle source
# File lib/voom/presenters/dsl/components/select.rb, line 18 def label(text=nil) return @label if locked? @label = text end
option(text=nil, **attribs, &block)
click to toggle source
# File lib/voom/presenters/dsl/components/select.rb, line 23 def option(text=nil, **attribs, &block) @options << Option.new(parent: self, text: text, **attribs, &block) end
value()
click to toggle source
# File lib/voom/presenters/dsl/components/select.rb, line 29 def value @options.select(&:_selected?).first&.value end