booster-time_parser 0.0.5.1 → 0.0.6
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/time_parser/core_ext.rb +25 -15
- data/lib/time_parser.rb +1 -1
- data/time_parser.gemspec +1 -1
- metadata +1 -1
data/lib/time_parser/core_ext.rb
CHANGED
@@ -1,25 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module TimeParser
|
2
|
+
module CoreExt
|
3
|
+
def to_seconds
|
4
|
+
self
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
def to_minutes
|
8
|
+
self / 60.0
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def to_hours
|
12
|
+
self / 3600.0
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
def to_days
|
16
|
+
self / 86_400.0
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
def to_weeks
|
20
|
+
self / 604_800.0
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
25
|
+
class Float
|
26
|
+
include TimeParser::CoreExt
|
27
|
+
end
|
28
|
+
|
29
|
+
class Fixnum
|
30
|
+
include TimeParser::CoreExt
|
31
|
+
end
|
32
|
+
|
23
33
|
class String
|
24
34
|
def to_seconds
|
25
35
|
TimeParser.parse(self)
|
data/lib/time_parser.rb
CHANGED
data/time_parser.gemspec
CHANGED