Class: FoxTail::Select::OptionGroupComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- FoxTail::Select::OptionGroupComponent
- Defined in:
- app/components/fox_tail/select/option_group_component.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(label, html_attributes = {}) ⇒ OptionGroupComponent
constructor
A new instance of OptionGroupComponent.
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
#label ⇒ Object (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_render ⇒ Object
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 |
#call ⇒ Object
24 25 26 27 28 |
# File 'app/components/fox_tail/select/option_group_component.rb', line 24 def call content_tag :optgroup, html_attributes do .each { |group_option| concat group_option } end end |