Class: Practical::Views::Form::InputComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Practical::Views::Form::InputComponent
- Defined in:
- app/components/practical/views/form/input_component.rb
Instance Attribute Summary collapse
-
#f ⇒ Object
Returns the value of attribute f.
-
#label_options ⇒ Object
Returns the value of attribute label_options.
-
#object_method ⇒ Object
Returns the value of attribute object_method.
Instance Method Summary collapse
- #field_errors_id ⇒ Object
- #field_options(**options) ⇒ Object
-
#initialize(f:, object_method:, label_options: {}) ⇒ InputComponent
constructor
A new instance of InputComponent.
Constructor Details
#initialize(f:, object_method:, label_options: {}) ⇒ InputComponent
Returns a new instance of InputComponent.
9 10 11 12 13 |
# File 'app/components/practical/views/form/input_component.rb', line 9 def initialize(f:, object_method:, label_options: {}) self.f = f self.object_method = object_method self. = end |
Instance Attribute Details
#f ⇒ Object
Returns the value of attribute f.
4 5 6 |
# File 'app/components/practical/views/form/input_component.rb', line 4 def f @f end |
#label_options ⇒ Object
Returns the value of attribute label_options.
4 5 6 |
# File 'app/components/practical/views/form/input_component.rb', line 4 def @label_options end |
#object_method ⇒ Object
Returns the value of attribute object_method.
4 5 6 |
# File 'app/components/practical/views/form/input_component.rb', line 4 def object_method @object_method end |
Instance Method Details
#field_errors_id ⇒ Object
15 16 17 |
# File 'app/components/practical/views/form/input_component.rb', line 15 def field_errors_id f.field_errors_id(object_method) end |
#field_options(**options) ⇒ Object
19 20 21 |
# File 'app/components/practical/views/form/input_component.rb', line 19 def (**) mix({"aria-describedby": field_errors_id}, ) end |