Class: Primer::Forms::AutoComplete

Inherits:
BaseComponent show all
Defined in:
lib/primer/forms/auto_complete.rb

Overview

:nodoc:

Constant Summary collapse

ARGUMENT_TYPES =
%i(keyreq key).freeze

Instance Attribute Summary

Attributes included from ActsAsComponent

#template_root_path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

#content, inherited, #input?, #perform_render, #render?, #to_component, #type

Methods included from ActsAsComponent

#compile!, extended, #renders_templates

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(input:) ⇒ AutoComplete

Returns a new instance of AutoComplete.



11
12
13
14
# File 'lib/primer/forms/auto_complete.rb', line 11

def initialize(input:)
  @input = input
  @input.merge_input_arguments!(text_field_attributes.deep_symbolize_keys)
end

Class Method Details

.auto_complete_argument_namesObject



16
17
18
19
20
21
# File 'lib/primer/forms/auto_complete.rb', line 16

def self.auto_complete_argument_names
  @auto_complete_argument_names ||=
    Primer::Beta::AutoComplete.instance_method(:initialize)
      .parameters
      .filter_map { |(type, param_name)| next param_name if ARGUMENT_TYPES.include?(type) }
end