Module: TimeagoHelper

Defined in:
app/helpers/timeago_helper.rb

Instance Method Summary collapse

Instance Method Details

#timeago(time = nil, html_options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'app/helpers/timeago_helper.rb', line 2

def timeago(time = nil, html_options = {})
  time = time.to_time if time.is_a? String
  classes = ['timeago']
  if html_options[:class]
    classes << html_options[:class]
  end
  html_options[:class] = classes * ' '
  html_options[:title] = time.getutc.iso8601
  (:abbr, time.try(:to_s), html_options)
end