Class: Sincer

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/sincer/sincer.rb,
lib/sincer/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.rephrase(time) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/sincer/sincer.rb', line 9

def rephrase(time)
  time = Time.parse(time) if time.is_a?(String)
  now = Time.now
  diff = (now - time).to_i

  "#{time_unit(diff)}#{past_or_future(diff)}"
end