def timeago_tag(time, html_options = {})
time_options = Rails::Timeago.default_options
time_options = time_options.merge html_options.extract!(*time_options.keys.select {|k| html_options.include?(k) })
return time_options[:default] if time.nil?
time_options[:format] = time_options[:format].call(time, time_options) if time_options[:format].is_a?(Proc)
if time_options[:title]
html_options[:title] = time_options[:title].is_a?(Proc) ? time_options[:title].call(time, time_options) : time_options[:title]
end
time_options[:limit] = time_options[:limit].call if time_options[:limit].is_a?(Proc)
time_range = unless time_options[:limit].nil?
now = Time.zone.now
limit = time_options[:limit]
limit < now ? limit...now : now...limit
end
if time_options[:force] || time_range.nil? || time_range.cover?(time)
html_options['data-time-ago'] = time.iso8601
end
time_tag time, timeago_tag_content(time, time_options), html_options
end