Sha256: e894ca545d94f382043789583b65fa5e5c934314d8e43209bebf330614357f20

Contents?: true

Size: 363 Bytes

Versions: 3

Compression:

Stored size: 363 Bytes

Contents

module TimeagoHelper
  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
    content_tag(:abbr, time.try(:to_s), html_options)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
andy_rails_toolbox-1.3.0 app/helpers/timeago_helper.rb
andy_rails_toolbox-1.2.1 app/helpers/timeago_helper.rb
andy_rails_toolbox-1.2.0 app/helpers/timeago_helper.rb