Class: ActiveForm::Element::CollectionOptionGroup
- Includes:
- Mixins::CollectionElementMethods
- Defined in:
- lib/active_form/mixins/collection_element_methods.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
Instance Method Summary collapse
-
#initialize(label, options = [], &block) ⇒ CollectionOptionGroup
constructor
A new instance of CollectionOptionGroup.
- #value ⇒ Object
Methods included from Mixins::CollectionElementMethods
#add_empty=, #add_empty_option, #add_optgroup, #add_option, #add_options, #blank?, #default_value, #each, #element_name, #element_value, #element_value=, #empty_option=, #fallback_value=, included, #option, #option_labels, #option_values, #options, #options=, #recurse, #required=, #reset_options!, #select_first=, #selected_option_label, #selected_value?, #valid_option?, #valid_value?
Constructor Details
#initialize(label, options = [], &block) ⇒ CollectionOptionGroup
194 195 196 197 198 |
# File 'lib/active_form/mixins/collection_element_methods.rb', line 194 def initialize(label, = [], &block) @label = label.to_s self. = block.call(self) if block_given? end |
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
192 193 194 |
# File 'lib/active_form/mixins/collection_element_methods.rb', line 192 def label @label end |
Instance Method Details
#value ⇒ Object
200 201 202 |
# File 'lib/active_form/mixins/collection_element_methods.rb', line 200 def value @options.collect(&:value) end |