Class: ActionView::Helpers::Tags::Label::LabelBuilder
- Defined in:
- actionview/lib/action_view/helpers/tags/label.rb
Overview
:nodoc:
Instance Attribute Summary collapse
- 
  
    
      #object  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute object. 
Instance Method Summary collapse
- 
  
    
      #initialize(template_object, object_name, method_name, object, tag_value)  ⇒ LabelBuilder 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of LabelBuilder. 
- #to_s ⇒ Object
- #translation ⇒ Object
Constructor Details
#initialize(template_object, object_name, method_name, object, tag_value) ⇒ LabelBuilder
Returns a new instance of LabelBuilder.
| 10 11 12 13 14 15 16 | # 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 ⇒ Object (readonly)
Returns the value of attribute object.
| 8 9 10 | # File 'actionview/lib/action_view/helpers/tags/label.rb', line 8 def object @object end | 
Instance Method Details
#to_s ⇒ Object
| 29 30 31 | # File 'actionview/lib/action_view/helpers/tags/label.rb', line 29 def to_s translation end | 
#translation ⇒ Object
| 18 19 20 21 22 23 24 25 26 27 | # 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 |