aeonic 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/aeonic.rb +10 -9
  2. metadata +1 -1
@@ -11,21 +11,22 @@ end
11
11
  class Aeonic
12
12
  def self.process(time)
13
13
 
14
- if time.isTimestamp?
15
- # If the time specified is a timestamp, output a human formatted date
16
- puts self.convertTimestampToDate(time)
17
- else
18
- # Otherwise parse with chronic, and output the date and a unix timestamp
19
- parsed = Chronic.parse(time)
20
- puts "#{parsed} : " << (parsed.to_time.to_i.to_s)
21
- end
14
+ # Set a default if no parameter passed
15
+ time = "now" if time == nil
16
+
17
+ # If the time specified is a timestamp, convert to a Time
18
+ time = self.convertTimestampToDate(time) if time.isTimestamp?
19
+
20
+ # Parse with chronic, and output the date and a unix timestamp
21
+ parsed = Chronic.parse(time)
22
+ puts "#{parsed} : " << (parsed.to_time.to_i.to_s) if parsed != nil
22
23
 
23
24
  end
24
25
 
25
26
  private
26
27
 
27
28
  def self.convertTimestampToDate(time)
28
- Time.strptime(time,'%s')
29
+ Time.strptime(time,'%s').to_s
29
30
  end
30
31
 
31
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aeonic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: