Sha256: 7a646e985aa69e49a0c8363660f923d2baa83efe3f1bc7a4fd0161dd63b5410c
Contents?: true
Size: 714 Bytes
Versions: 7
Compression:
Stored size: 714 Bytes
Contents
module Toro module Monitor class TimeFormatter class << self include ActionView::Helpers::DateHelper def distance_of_time(from_time, to_time) replacements = { 'less than ' => '', 'about ' => '', ' days' => 'd', ' day' => 'd', ' hours' => 'h', ' hour' => 'h', ' minutes' => 'm', ' minute' => 'm', ' seconds' => 's', ' second' => 's' } phrase = distance_of_time_in_words(from_time, to_time, include_seconds: true) replacements.each { |from, to| phrase.gsub!(from, to) } phrase end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems