chronic_duration 0.7.5 → 0.8.0
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/VERSION +1 -1
- data/chronic_duration.gemspec +2 -2
- data/lib/chronic_duration.rb +4 -0
- data/spec/chronic_duration_spec.rb +6 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/chronic_duration.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{chronic_duration}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.8.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["hpoydar"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-12-15}
|
13
13
|
s.description = %q{A simple Ruby natural language parser for elapsed time. (For example, 4 hours and 30 minutes, 6 minutes 4 seconds, 3 days, etc.) Returns all results in seconds. Will return an integer unless you get tricky and need a float. (4 minutes and 13.47 seconds, for example.) The reverse can also be performed via the output method.}
|
14
14
|
s.email = %q{hpoydar@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/chronic_duration.rb
CHANGED
@@ -43,6 +43,10 @@ module ChronicDuration
|
|
43
43
|
process = nil
|
44
44
|
|
45
45
|
case opts[:format]
|
46
|
+
when :micro
|
47
|
+
dividers = {
|
48
|
+
:years => 'y', :months => 'm', :days => 'd', :hours => 'h', :minutes => 'm', :seconds => 's' }
|
49
|
+
joiner = ''
|
46
50
|
when :short
|
47
51
|
dividers = {
|
48
52
|
:years => 'y', :months => 'm', :days => 'd', :hours => 'h', :minutes => 'm', :seconds => 's' }
|
@@ -47,6 +47,7 @@ describe ChronicDuration, '.output' do
|
|
47
47
|
@exemplars = {
|
48
48
|
(60 + 20) =>
|
49
49
|
{
|
50
|
+
:micro => '1m20s',
|
50
51
|
:short => '1m 20s',
|
51
52
|
:default => '1 min 20 secs',
|
52
53
|
:long => '1 minute 20 seconds',
|
@@ -54,6 +55,7 @@ describe ChronicDuration, '.output' do
|
|
54
55
|
},
|
55
56
|
(60 + 20.51) =>
|
56
57
|
{
|
58
|
+
:micro => '1m20.51s',
|
57
59
|
:short => '1m 20.51s',
|
58
60
|
:default => '1 min 20.51 secs',
|
59
61
|
:long => '1 minute 20.51 seconds',
|
@@ -61,6 +63,7 @@ describe ChronicDuration, '.output' do
|
|
61
63
|
},
|
62
64
|
(4 * 3600 + 60 + 1) =>
|
63
65
|
{
|
66
|
+
:micro => '4h1m1s',
|
64
67
|
:short => '4h 1m 1s',
|
65
68
|
:default => '4 hrs 1 min 1 sec',
|
66
69
|
:long => '4 hours 1 minute 1 second',
|
@@ -68,6 +71,7 @@ describe ChronicDuration, '.output' do
|
|
68
71
|
},
|
69
72
|
(2 * 3600 + 20 * 60) =>
|
70
73
|
{
|
74
|
+
:micro => '2h20m',
|
71
75
|
:short => '2h 20m',
|
72
76
|
:default => '2 hrs 20 mins',
|
73
77
|
:long => '2 hours 20 minutes',
|
@@ -75,6 +79,7 @@ describe ChronicDuration, '.output' do
|
|
75
79
|
},
|
76
80
|
(2 * 3600 + 20 * 60) =>
|
77
81
|
{
|
82
|
+
:micro => '2h20m',
|
78
83
|
:short => '2h 20m',
|
79
84
|
:default => '2 hrs 20 mins',
|
80
85
|
:long => '2 hours 20 minutes',
|
@@ -82,6 +87,7 @@ describe ChronicDuration, '.output' do
|
|
82
87
|
},
|
83
88
|
(6 * 30 * 24 * 3600 + 24 * 3600) =>
|
84
89
|
{
|
90
|
+
:micro => '6m1d',
|
85
91
|
:short => '6m 1d',
|
86
92
|
:default => '6 mos 1 day',
|
87
93
|
:long => '6 months 1 day',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chronic_duration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hpoydar
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-15 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|