Class: ActionView::Helpers::AttributeBuilders::CheckBox
- Includes:
- Checkable
- Defined in:
- lib/actionview_attribute_builders/attribute_builders/check_box.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #html_attributes ⇒ Object
-
#initialize(object_name, method_name, template_object, checked_value, options) ⇒ CheckBox
constructor
A new instance of CheckBox.
Methods included from Checkable
Constructor Details
#initialize(object_name, method_name, template_object, checked_value, options) ⇒ CheckBox
Returns a new instance of CheckBox.
11 12 13 14 |
# File 'lib/actionview_attribute_builders/attribute_builders/check_box.rb', line 11 def initialize(object_name, method_name, template_object, checked_value, ) @checked_value = checked_value super(object_name, method_name, template_object, ) end |
Instance Method Details
#html_attributes ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/actionview_attribute_builders/attribute_builders/check_box.rb', line 16 def html_attributes = @options.stringify_keys ["type"] = "checkbox" ["value"] = @checked_value ["checked"] = "checked" if input_checked?() if ["multiple"] add_default_name_and_id_for_value(@checked_value, ) .delete("multiple") else add_default_name_and_id() end return end |