Module: T::Utils

Included in:
CLI, Delete, List, Search, Stream
Defined in:
lib/t/utils.rb

Constant Summary collapse

DISTANCE_THRESHOLDS =
[
  [2, "a minute"],
  [60, ->(m) { format("%<minutes>d minutes", minutes: m) }],
  [120, "an hour"],
  [1410, ->(m) { format("%<hours>d hours", hours: (m.to_f / 60.0).round) }],
  [2880, "a day"],
  [42_480, ->(m) { format("%<days>d days", days: (m.to_f / 1440.0).round) }],
  [86_400, "a month"],
  [503_700, ->(m) { format("%<months>d months", months: (m.to_f / 43_800.0).round) }],
  [1_051_200, "a year"],
].freeze