Class: Formulaic::Label
- Inherits:
-
Object
- Object
- Formulaic::Label
- Defined in:
- lib/formulaic/label.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#model_name ⇒ Object
readonly
Returns the value of attribute model_name.
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.
5 6 7 8 9 |
# File 'lib/formulaic/label.rb', line 5 def initialize(model_name, attribute, action) @model_name = model_name @attribute = attribute @action = action end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/formulaic/label.rb', line 3 def action @action end |
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
3 4 5 |
# File 'lib/formulaic/label.rb', line 3 def attribute @attribute end |
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
3 4 5 |
# File 'lib/formulaic/label.rb', line 3 def model_name @model_name end |
Instance Method Details
#to_str ⇒ Object Also known as: to_s
11 12 13 14 15 16 17 |
# File 'lib/formulaic/label.rb', line 11 def to_str if attribute.is_a?(String) attribute else translate || human_attribute_name || attribute.to_s end end |