brianjlandau-chronic_duration 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/brianjlandau-chronic_duration.gemspec +2 -2
- data/lib/chronic_duration.rb +1 -1
- data/spec/chronic_duration_spec.rb +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.2
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{brianjlandau-chronic_duration}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["hpoydar", "brianjlandau"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-09}
|
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
@@ -137,7 +137,7 @@ private
|
|
137
137
|
def duration_units_seconds_multiplier(unit)
|
138
138
|
return 0 unless duration_units_list.include?(unit)
|
139
139
|
case unit
|
140
|
-
when 'years';
|
140
|
+
when 'years'; 31557600 # accounts for leap years
|
141
141
|
when 'months'; 3600 * 24 * 30
|
142
142
|
when 'weeks'; 3600 * 24 * 7
|
143
143
|
when 'days'; 3600 * 24
|
@@ -12,9 +12,9 @@ describe ChronicDuration, '.parse' do
|
|
12
12
|
'2 hrs 20 min' => 2 * 3600 + 20 * 60,
|
13
13
|
'2h20min' => 2 * 3600 + 20 * 60,
|
14
14
|
'6 mos 1 day' => 6 * 30 * 24 * 3600 + 24 * 3600,
|
15
|
-
'1 year 6 mos 1 day' => 1 *
|
15
|
+
'1 year 6 mos 1 day' => 1 * 31557600 + 6 * 30 * 24 * 3600 + 24 * 3600,
|
16
16
|
'2.5 hrs' => 2.5 * 3600,
|
17
|
-
'47 yrs 6 mos and 4.5d' => 47 *
|
17
|
+
'47 yrs 6 mos and 4.5d' => 47 * 31557600 + 6 * 30 * 24 * 3600 + 4.5 * 24 * 3600,
|
18
18
|
'two hours and twenty minutes' => 2 * 3600 + 20 * 60,
|
19
19
|
'four hours and forty minutes' => 4 * 3600 + 40 * 60,
|
20
20
|
'four hours, and fourty minutes' => 4 * 3600 + 40 * 60,
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 2
|
9
|
+
version: 0.9.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- hpoydar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-03-
|
18
|
+
date: 2010-03-09 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|