Class: ActionView::Helpers::AttributeBuilders::RadioButton

Inherits:
Base
  • Object
show all
Includes:
Tags::Checkable
Defined in:
lib/actionview_attribute_builders/attribute_builders/radio_button.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Base

#object

Instance Method Summary collapse

Constructor Details

#initialize(object_name, method_name, template_object, tag_value, options) ⇒ RadioButton

Returns a new instance of RadioButton.



11
12
13
14
# File 'lib/actionview_attribute_builders/attribute_builders/radio_button.rb', line 11

def initialize(object_name, method_name, template_object, tag_value, options)
  @tag_value = tag_value
  super(object_name, method_name, template_object, options)
end

Instance Method Details

#html_attributesObject



16
17
18
19
20
21
22
23
24
# File 'lib/actionview_attribute_builders/attribute_builders/radio_button.rb', line 16

def html_attributes
  options = @options.stringify_keys
  options["type"]     = "radio"
  options["value"]    = @tag_value
  options["checked"] = "checked" if input_checked?(options)
  add_default_name_and_id_for_value(@tag_value, options)
  
  return options
end