Class: Ariadne::Forms::Dsl::RadioButtonGroupInput
- Defined in:
- lib/ariadne/forms/dsl/radio_button_group_input.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Input
Input::DEFAULT_SIZE, Input::SIZE_MAPPINGS, Input::SIZE_OPTIONS, Input::SPACE_DELIMITED_ARIA_ATTRIBUTES
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#radio_buttons ⇒ Object
readonly
Returns the value of attribute radio_buttons.
Attributes inherited from Input
#base_id, #builder, #caption, #form, #form_control, #ids, #input_attributes, #label_attributes, #validation_message
Instance Method Summary collapse
- #autofocus! ⇒ Object
- #focusable? ⇒ Boolean
-
#initialize(name:, label: nil, **options) {|_self| ... } ⇒ RadioButtonGroupInput
constructor
A new instance of RadioButtonGroupInput.
- #radio_button(**options, &block) ⇒ Object
- #to_component ⇒ Object
- #type ⇒ Object
Methods inherited from Input
#add_input_aria, #add_input_classes, #add_input_data, #caption?, #caption_id, #caption_template?, #disabled?, #hidden?, #id, #input?, #invalid?, #merge_input_attributes!, #remove_input_data, #render_caption_template, #required?, #size, #supports_validation?, #valid?, #validation_arguments, #validation_error_icon_target, #validation_id, #validation_message_arguments, #validation_messages, #validation_success_icon_target
Methods included from ClassNameHelper
Constructor Details
#initialize(name:, label: nil, **options) {|_self| ... } ⇒ RadioButtonGroupInput
Returns a new instance of RadioButtonGroupInput.
10 11 12 13 14 15 16 17 18 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 10 def initialize(name:, label: nil, **) @name = name @label = label @radio_buttons = [] super(**) yield(self) if block_given? end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
8 9 10 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 8 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 8 def name @name end |
#radio_buttons ⇒ Object (readonly)
Returns the value of attribute radio_buttons.
8 9 10 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 8 def @radio_buttons end |
Instance Method Details
#autofocus! ⇒ Object
32 33 34 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 32 def autofocus! @radio_buttons.first&.autofocus! end |
#focusable? ⇒ Boolean
36 37 38 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 36 def focusable? true end |
#radio_button(**options, &block) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 40 def (**, &block) @radio_buttons << RadioButtonInput.new( builder: @builder, form: @form, name: @name, disabled: disabled?, **, &block ).to_component end |
#to_component ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 20 def to_component component = Ariadne::Form::RadioButtonGroup::Component.new(name:, label:, **@options) @radio_buttons.each do || component.() end component end |
#type ⇒ Object
28 29 30 |
# File 'lib/ariadne/forms/dsl/radio_button_group_input.rb', line 28 def type :radio_button_group end |