123456789_123456789_123456789_123456789_123456789_

Class: ActionView::Helpers::Tags::Label::LabelBuilder

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: actionview/lib/action_view/helpers/tags/label.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(template_object, object_name, method_name, object, tag_value) ⇒ LabelBuilder

[ GitHub ]

  
# File 'actionview/lib/action_view/helpers/tags/label.rb', line 10

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

Instance Attribute Details

#object (readonly)

[ GitHub ]

  
# File 'actionview/lib/action_view/helpers/tags/label.rb', line 8

attr_reader :object

Instance Method Details

#to_s

[ GitHub ]

  
# File 'actionview/lib/action_view/helpers/tags/label.rb', line 29

def to_s
  translation
end

#translation

[ GitHub ]

  
# File 'actionview/lib/action_view/helpers/tags/label.rb', line 18

def translation
  method_and_value = @tag_value.present? ? "#{@method_name}.#{@tag_value}" : @method_name

  content ||= Translator
    .new(object, @object_name, method_and_value, scope: "helpers.label")
    .translate
  content ||= @method_name.humanize

  content
end