Module: Tramway::Core::Concerns::AttributesDecoratorHelper

Included in:
ApplicationDecorator
Defined in:
app/decorators/tramway/core/concerns/attributes_decorator_helper.rb

Instance Method Summary collapse

Instance Method Details

#date_view(value) ⇒ Object



2
3
4
# File 'app/decorators/tramway/core/concerns/attributes_decorator_helper.rb', line 2

def date_view(value)
  I18n.l value.to_date if value
end

#datetime_view(value) ⇒ Object



6
7
8
# File 'app/decorators/tramway/core/concerns/attributes_decorator_helper.rb', line 6

def datetime_view(value)
  I18n.l value if value
end

#state_machine_view(object, attribute_name) ⇒ Object



10
11
12
# File 'app/decorators/tramway/core/concerns/attributes_decorator_helper.rb', line 10

def state_machine_view(object, attribute_name)
  object.send "human_#{attribute_name}_name"
end