class Toro::Monitor::TimeFormatter
Public Class Methods
distance_of_time(from_time, to_time)
click to toggle source
# File lib/toro/monitor/time_formatter.rb, line 7 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