Class: Formulaic::Label

Inherits:
Object
  • Object
show all
Defined in:
lib/formulaic/label.rb

Instance Method Summary collapse

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_strObject 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