Class: Formulaic::Label
- Inherits:
-
Object
- Object
- Formulaic::Label
- Defined in:
- lib/formulaic/label.rb
Instance Method Summary collapse
-
#initialize(model_name, attribute, action) ⇒ Label
constructor
A new instance of Label.
- #to_str ⇒ Object (also: #to_s)
Constructor Details
#initialize(model_name, attribute, action) ⇒ Label
Returns a new instance of Label.
3 4 5 6 7 |
# File 'lib/formulaic/label.rb', line 3 def initialize(model_name, attribute, action) @model_name = model_name @attribute = attribute @action = action end |
Instance Method Details
#to_str ⇒ Object Also known as: to_s
9 10 11 12 13 14 15 |
# File 'lib/formulaic/label.rb', line 9 def to_str if attribute.is_a?(String) attribute else translate || human_attribute_name || attribute.to_s end end |