Module: WhatTheGem::I

Extended by:
I
Included in:
I
Defined in:
lib/whatthegem/i.rb

Overview

I for Internal

Defined Under Namespace

Modules: Callable, Kramdowns, RDocs

Constant Summary collapse

Pastel =
::Pastel.new

Instance Method Summary collapse

Instance Method Details

#ago_text(tm) ⇒ Object



49
50
51
52
53
# File 'lib/whatthegem/i.rb', line 49

def ago_text(tm)
  diff = TimeCalc.now.-(tm).factorize
  unit, num = diff.detect { |_, v| !v.zero? }
  "#{num} #{unit}#{'s' unless num == 1} ago"
end