Class: CafeCar::DateTimePresenter

Inherits:
Presenter
  • Object
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

Methods included from OptionHelpers

#assign_option!, #assign_options!, #get_options

Methods included from Caching

#cache

Constructor Details

This class inherits a constructor from CafeCar::Presenter

Instance Method Details

#datetimeObject



5
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 5

def datetime = object.iso8601

#distanceObject



3
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 3

def distance = @template.time_ago_in_words(object)

#longObject



6
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 6

def long    = l(object, format: :long)

#stringObject



8
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 8

def string  = words

#to_htmlObject



9
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 9

def to_html = tag.time words, datetime:, "data-tip": long

#wordsObject



4
# File 'app/presenters/cafe_car/date_time_presenter.rb', line 4

def words    = object.past? ? "#{distance} ago" : "in #{distance}"