Class: FoxTail::Select::OptionGroupComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/fox_tail/select/option_group_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, html_attributes = {}) ⇒ OptionGroupComponent

Returns a new instance of OptionGroupComponent.



13
14
15
16
# File 'app/components/fox_tail/select/option_group_component.rb', line 13

def initialize(label, html_attributes = {})
  @label = label
  super(html_attributes)
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



4
5
6
# File 'app/components/fox_tail/select/option_group_component.rb', line 4

def label
  @label
end

Instance Method Details

#before_renderObject



18
19
20
21
22
# File 'app/components/fox_tail/select/option_group_component.rb', line 18

def before_render
  super

  html_attributes[:label] = label
end

#callObject



24
25
26
27
28
# File 'app/components/fox_tail/select/option_group_component.rb', line 24

def call
   :optgroup, html_attributes do
    group_options.each { |group_option| concat group_option }
  end
end