Class: Koi::SummaryList::DatetimeComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/koi/summary_list/datetime_component.rb

Instance Method Summary collapse

Methods inherited from Base

#attribute_name, #call, #inspect, #raw_value, #render?, #to_s

Constructor Details

#initialize(model, attribute, format: :admin, **options) ⇒ DatetimeComponent

Returns a new instance of DatetimeComponent.



6
7
8
9
10
# File 'app/components/koi/summary_list/datetime_component.rb', line 6

def initialize(model, attribute, format: :admin, **options)
  super(model, attribute, **options)

  @format = format
end

Instance Method Details

#attribute_valueObject



12
13
14
# File 'app/components/koi/summary_list/datetime_component.rb', line 12

def attribute_value
  l(raw_value.to_datetime, format: @format) if raw_value.present?
end