Module: DateTimeAgoInWords

Included in:
DateTime
Defined in:
lib/devlog.rb

Instance Method Summary collapse

Instance Method Details

#ago_in_wordsObject



730
731
732
733
734
735
736
737
738
# File 'lib/devlog.rb', line 730

def ago_in_words
  return 'a very very long time ago' if self.year < 1800
  secs = Time.now - self
  return 'just over' if secs > -1 && secs < 1
  return 'now' if secs <= -1
  pair = ago_in_words_pair(secs)
  ary = ago_in_words_singularize(pair)
  ary.size == 0 ? '' : ary.join(' and ') << ' ago'
end