Class: Ariadne::Forms::Dsl::RadioButtonInput
- Defined in:
- lib/ariadne/forms/dsl/radio_button_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.
-
#nested_form_arguments ⇒ Object
readonly
Returns the value of attribute nested_form_arguments.
-
#nested_form_block ⇒ Object
readonly
Returns the value of attribute nested_form_block.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Input
#base_id, #builder, #caption, #form, #form_control, #ids, #input_attributes, #label_attributes, #validation_message
Instance Method Summary collapse
-
#initialize(name:, value:, label:, **options) {|_self| ... } ⇒ RadioButtonInput
constructor
A new instance of RadioButtonInput.
- #nested_form(**system_arguments, &block) ⇒ Object
-
#supports_validation? ⇒ Boolean
:nocov:.
-
#to_component ⇒ Object
:nocov:.
-
#type ⇒ Object
:nocov:.
-
#valid? ⇒ Boolean
radio buttons cannot be invalid, as both selected and unselected are valid states :nocov:.
Methods inherited from Input
#add_input_aria, #add_input_classes, #add_input_data, #autofocus!, #caption?, #caption_id, #caption_template?, #disabled?, #focusable?, #hidden?, #id, #input?, #invalid?, #merge_input_attributes!, #remove_input_data, #render_caption_template, #required?, #size, #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:, value:, label:, **options) {|_self| ... } ⇒ RadioButtonInput
Returns a new instance of RadioButtonInput.
10 11 12 13 14 15 16 17 18 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 10 def initialize(name:, value:, label:, **) @name = name @value = value @label = label 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_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_input.rb', line 8 def name @name end |
#nested_form_arguments ⇒ Object (readonly)
Returns the value of attribute nested_form_arguments.
8 9 10 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 8 def nested_form_arguments @nested_form_arguments end |
#nested_form_block ⇒ Object (readonly)
Returns the value of attribute nested_form_block.
8 9 10 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 8 def nested_form_block @nested_form_block end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 8 def value @value end |
Instance Method Details
#nested_form(**system_arguments, &block) ⇒ Object
31 32 33 34 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 31 def nested_form(**system_arguments, &block) @nested_form_arguments = system_arguments @nested_form_block = block end |
#supports_validation? ⇒ Boolean
:nocov:
42 43 44 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 42 def supports_validation? false end |
#to_component ⇒ Object
:nocov:
27 28 29 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 27 def to_component Ariadne::Form::RadioButton::Component.new(name:, value:, label:, **@options) end |
#type ⇒ Object
:nocov:
37 38 39 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 37 def type :radio_button end |
#valid? ⇒ Boolean
radio buttons cannot be invalid, as both selected and unselected are valid states :nocov:
22 23 24 |
# File 'lib/ariadne/forms/dsl/radio_button_input.rb', line 22 def valid? true end |