Class: CafeCar::DateTimePresenter
- Inherits:
-
Presenter
show all
- Defined in:
- app/presenters/cafe_car/date_time_presenter.rb
Instance Attribute Summary
Attributes inherited from Presenter
#block, #object, #options
Instance Method Summary
collapse
Methods inherited from Presenter
#associations, #attribute, #attributes, candidates, #controls, find, #has_partial?, #href, #html_safe?, #human, #i18n, #i18n_vars, #info, #info_circle, inherited, #initialize, #links, #logo, #model, names, #partial, present, #present, #preview, #remaining_attributes, show, #show, #timestamps, #title, #to_model, #to_s, #value
#assign_option!, #assign_options!, #get_options
Methods included from Caching
#cache
Instance Method Details
#datetime ⇒ Object
5
|
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 5
def datetime = object.iso8601
|
#distance ⇒ Object
3
|
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 3
def distance = @template.time_ago_in_words(object)
|
#long ⇒ Object
6
|
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 6
def long = l(object, format: :long)
|
#string ⇒ Object
8
|
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 8
def string = words
|
#to_html ⇒ Object
9
|
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 9
def to_html = tag.time words, datetime:, "data-tip": long
|
#words ⇒ Object
4
|
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 4
def words = object.past? ? "#{distance} ago" : "in #{distance}"
|