Class: PhlexUI::Input

Inherits:
Base
  • Object
show all
Defined in:
lib/phlex_ui/input.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#before_template

Constructor Details

#initialize(type: :string, error: nil, **attrs) ⇒ Input

Returns a new instance of Input.



5
6
7
8
9
# File 'lib/phlex_ui/input.rb', line 5

def initialize(type: :string, error: nil, **attrs)
  @type = type.to_sym
  @error = error
  super(**attrs)
end

Instance Method Details

#view_templateObject



11
12
13
14
# File 'lib/phlex_ui/input.rb', line 11

def view_template
  input(type: @type, **attrs)
  render PhlexUI::InputError.new { @error } if @error
end