Class: Aeonic

Inherits:
Object
  • Object
show all
Defined in:
lib/aeonic.rb

Class Method Summary collapse

Class Method Details

.process(time) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/aeonic.rb', line 12

def self.process(time)

  # Set a default if no parameter passed
  time = "now" if time == nil

  # If the time specified is a timestamp, convert to a Time
  time = self.convertTimestampToDate(time) if time.isTimestamp?

  # Parse with chronic, and output the date and a unix timestamp
  parsed = Chronic.parse(time)
  puts "#{parsed} : " << (parsed.to_time.to_i.to_s) if parsed != nil

end