Class: ViewComponent::Form::CheckBoxComponent
- Inherits:
-
FieldComponent
- Object
- BaseComponent
- FieldComponent
- ViewComponent::Form::CheckBoxComponent
- Defined in:
- app/components/view_component/form/check_box_component.rb
Instance Attribute Summary collapse
-
#checked_value ⇒ Object
readonly
Returns the value of attribute checked_value.
-
#unchecked_value ⇒ Object
readonly
Returns the value of attribute unchecked_value.
Attributes inherited from FieldComponent
Attributes inherited from BaseComponent
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(form, object_name, method_name, checked_value, unchecked_value, options = {}) ⇒ CheckBoxComponent
constructor
rubocop:disable Metrics/ParameterLists.
Methods inherited from FieldComponent
#label_text, #method_errors, #method_errors?, #object_method_names, #optional?, #required?, #validators, #value
Methods inherited from BaseComponent
#html_class, #object_errors, #object_errors?
Methods included from ClassNamesHelper
#build_tag_values, #class_names
Constructor Details
#initialize(form, object_name, method_name, checked_value, unchecked_value, options = {}) ⇒ CheckBoxComponent
rubocop:disable Metrics/ParameterLists
8 9 10 11 12 13 |
# File 'app/components/view_component/form/check_box_component.rb', line 8 def initialize(form, object_name, method_name, checked_value, unchecked_value, = {}) # rubocop:disable Metrics/ParameterLists @checked_value = checked_value @unchecked_value = unchecked_value super(form, object_name, method_name, ) end |
Instance Attribute Details
#checked_value ⇒ Object (readonly)
Returns the value of attribute checked_value.
6 7 8 |
# File 'app/components/view_component/form/check_box_component.rb', line 6 def checked_value @checked_value end |
#unchecked_value ⇒ Object (readonly)
Returns the value of attribute unchecked_value.
6 7 8 |
# File 'app/components/view_component/form/check_box_component.rb', line 6 def unchecked_value @unchecked_value end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/view_component/form/check_box_component.rb', line 15 def call ActionView::Helpers::Tags::CheckBox.new( object_name, method_name, @view_context, checked_value, unchecked_value, ).render end |