Class: TaoForm::Components::RadioButtonComponent
- Inherits:
-
FieldComponent
- Object
- TaoOnRails::Components::Base
- FieldComponent
- TaoForm::Components::RadioButtonComponent
- Defined in:
- lib/tao_form/components/radio_button_component.rb
Instance Attribute Summary collapse
-
#checked ⇒ Object
readonly
Returns the value of attribute checked.
-
#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
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(view, builder = nil, attribute_name = nil, options = {}, checked_value = '1', unchecked_value = '0') ⇒ RadioButtonComponent
constructor
A new instance of RadioButtonComponent.
- #render(&block) ⇒ Object
Constructor Details
#initialize(view, builder = nil, attribute_name = nil, options = {}, checked_value = '1', unchecked_value = '0') ⇒ RadioButtonComponent
Returns a new instance of RadioButtonComponent.
7 8 9 10 11 12 |
# File 'lib/tao_form/components/radio_button_component.rb', line 7 def initialize view, builder = nil, attribute_name = nil, = {}, checked_value = '1', unchecked_value = '0' super view, builder, attribute_name, @checked = @options.delete(:checked) @checked_value = checked_value @unchecked_value = unchecked_value end |
Instance Attribute Details
#checked ⇒ Object (readonly)
Returns the value of attribute checked.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def checked @checked end |
#checked_value ⇒ Object (readonly)
Returns the value of attribute checked_value.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def checked_value @checked_value end |
#unchecked_value ⇒ Object (readonly)
Returns the value of attribute unchecked_value.
5 6 7 |
# File 'lib/tao_form/components/radio_button_component.rb', line 5 def unchecked_value @unchecked_value end |
Class Method Details
.component_name ⇒ Object
14 15 16 |
# File 'lib/tao_form/components/radio_button_component.rb', line 14 def self.component_name :radio_button end |
Instance Method Details
#render(&block) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/tao_form/components/radio_button_component.rb', line 18 def render &block if block_given? super else super { builder. attribute_name, {checked: checked}, checked_value, unchecked_value } end end |