Class: Fluxbit::Form::SelectInputComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/fluxbit/form/select_input_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs, &block) ⇒ SelectInputComponent

Returns a new instance of SelectInputComponent.



4
5
6
7
8
9
10
11
# File 'app/components/fluxbit/form/select_input_component.rb', line 4

def initialize(**kwargs, &block)
  super
  kwargs[:type] = :select

  @component_klass = "Fluxbit::Form::TextInputComponent".constantize
  @kwargs = kwargs
  @block = block
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'app/components/fluxbit/form/select_input_component.rb', line 13

def call
  if @kwargs[:with_content]
    content = @kwargs.delete(:with_content)
    render(@component_klass.new(**@kwargs).with_content(content), &@block)
  else
    render(@component_klass.new(**@kwargs), &@block)
  end
end