Class: ActionView::Helpers::AttributeBuilders::Label
- Defined in:
- lib/actionview_attribute_builders/attribute_builders/label.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Attributes inherited from Base
Instance Method Summary collapse
- #html_attributes(&block) ⇒ Object
-
#initialize(object_name, method_name, template_object, content_or_options, options = nil) ⇒ Label
constructor
A new instance of Label.
Constructor Details
#initialize(object_name, method_name, template_object, content_or_options, options = nil) ⇒ Label
Returns a new instance of Label.
7 8 9 10 11 12 13 14 15 |
# File 'lib/actionview_attribute_builders/attribute_builders/label.rb', line 7 def initialize(object_name, method_name, template_object, , = nil) ||= {} if .is_a?(Hash) .merge! else @content = end super(object_name, method_name, template_object, ) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
17 18 19 |
# File 'lib/actionview_attribute_builders/attribute_builders/label.rb', line 17 def content @content end |
Instance Method Details
#html_attributes(&block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/actionview_attribute_builders/attribute_builders/label.rb', line 19 def html_attributes(&block) = .stringify_keys name_and_id = .dup if name_and_id["for"] name_and_id["id"] = name_and_id["for"] else name_and_id.delete("id") end add_default_name_and_id_for_value(["value"], name_and_id) .delete("index") .delete("namespace") ["for"] = name_and_id["id"] unless .key?("for") end |