aeonic 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/aeonic.rb +10 -9
- metadata +1 -1
data/lib/aeonic.rb
CHANGED
@@ -11,21 +11,22 @@ end
|
|
11
11
|
class Aeonic
|
12
12
|
def self.process(time)
|
13
13
|
|
14
|
-
if
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|