Class: Practical::Views::RelativeTimeComponent

Inherits:
ApplicationComponent
  • Object
show all
Defined in:
app/components/practical/views/relative_time_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time:) ⇒ RelativeTimeComponent

Returns a new instance of RelativeTimeComponent.



6
7
8
# File 'app/components/practical/views/relative_time_component.rb', line 6

def initialize(time:)
  @time = time
end

Instance Attribute Details

#timeObject

Returns the value of attribute time.



4
5
6
# File 'app/components/practical/views/relative_time_component.rb', line 4

def time
  @time
end

Instance Method Details

#callObject



10
11
12
# File 'app/components/practical/views/relative_time_component.rb', line 10

def call
  tag.wa_relative_time(helpers.time_ago_in_words(time), date: time.iso8601)
end