Class: Primer::Forms::Dsl::SelectInput
- Inherits:
-
Input
- Object
- Input
- Primer::Forms::Dsl::SelectInput
- Defined in:
- lib/ariadne/forms/dsl/select_input.rb
Overview
:nodoc:
Constant Summary collapse
- SELECT_ARGUMENTS =
[:multiple, :include_blank, :include_hidden, :prompt].freeze
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#select_arguments ⇒ Object
readonly
Returns the value of attribute select_arguments.
Instance Method Summary collapse
-
#focusable? ⇒ Boolean
:nocov:.
-
#initialize(name:, label:, **options) {|_self| ... } ⇒ SelectInput
constructor
A new instance of SelectInput.
- #multiple? ⇒ Boolean
- #to_component ⇒ Object
-
#type ⇒ Object
:nocov:.
Constructor Details
#initialize(name:, label:, **options) {|_self| ... } ⇒ SelectInput
Returns a new instance of SelectInput.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 12 def initialize(name:, label:, **) @name = name @label = label @options = [] @select_arguments = {}.tap do |select_args| SELECT_ARGUMENTS.each do |select_arg| select_args[select_arg] = .delete(select_arg) end end super(**) yield(self) if block_given? end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
10 11 12 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 10 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 10 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 10 def @options end |
#select_arguments ⇒ Object (readonly)
Returns the value of attribute select_arguments.
10 11 12 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 10 def select_arguments @select_arguments end |
Instance Method Details
#focusable? ⇒ Boolean
:nocov:
43 44 45 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 43 def focusable? true end |
#multiple? ⇒ Boolean
28 29 30 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 28 def multiple? @select_arguments.fetch(:multiple, false) end |
#to_component ⇒ Object
32 33 34 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 32 def to_component Ariadne::Form::Select::Component.new(name:, label:, **@options) end |
#type ⇒ Object
:nocov:
37 38 39 |
# File 'lib/ariadne/forms/dsl/select_input.rb', line 37 def type :select_list end |