Class: Practical::Views::RelativeTimeComponent
- Inherits:
-
ApplicationComponent
- Object
- ApplicationComponent
- Practical::Views::RelativeTimeComponent
- Defined in:
- app/components/practical/views/relative_time_component.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(time:) ⇒ RelativeTimeComponent
constructor
A new instance of RelativeTimeComponent.
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
#time ⇒ Object
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
#call ⇒ Object
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 |