brianjlandau-chronic_duration 0.8.3 → 0.9.1
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 +3 -3
- data/lib/chronic_duration.rb +2 -1
- data/spec/chronic_duration_spec.rb +2 -1
- metadata +18 -9
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.1
|
@@ -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.
|
8
|
+
s.version = "0.9.1"
|
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-
|
12
|
+
s.date = %q{2010-03-08}
|
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 = [
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.homepage = %q{http://github.com/brianjlandau/chronic_duration}
|
30
30
|
s.rdoc_options = ["--charset=UTF-8"]
|
31
31
|
s.require_paths = ["lib"]
|
32
|
-
s.rubygems_version = %q{1.3.
|
32
|
+
s.rubygems_version = %q{1.3.6}
|
33
33
|
s.summary = %q{A Ruby natural language parser for elapsed time}
|
34
34
|
s.test_files = [
|
35
35
|
"spec/chronic_duration_spec.rb"
|
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'; 31536000 # doesn't accounts for leap years
|
141
141
|
when 'months'; 3600 * 24 * 30
|
142
142
|
when 'weeks'; 3600 * 24 * 7
|
143
143
|
when 'days'; 3600 * 24
|
@@ -216,6 +216,7 @@ private
|
|
216
216
|
'months' => 'months',
|
217
217
|
'mos' => 'months',
|
218
218
|
'years' => 'years',
|
219
|
+
'year' => 'years',
|
219
220
|
'yrs' => 'years',
|
220
221
|
'y' => 'years'
|
221
222
|
}
|
@@ -12,8 +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 * 31536000 + 6 * 30 * 24 * 3600 + 24 * 3600,
|
15
16
|
'2.5 hrs' => 2.5 * 3600,
|
16
|
-
'47 yrs 6 mos and 4.5d' => 47 *
|
17
|
+
'47 yrs 6 mos and 4.5d' => 47 * 31536000 + 6 * 30 * 24 * 3600 + 4.5 * 24 * 3600,
|
17
18
|
'two hours and twenty minutes' => 2 * 3600 + 20 * 60,
|
18
19
|
'four hours and forty minutes' => 4 * 3600 + 40 * 60,
|
19
20
|
'four hours, and fourty minutes' => 4 * 3600 + 40 * 60,
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brianjlandau-chronic_duration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 9
|
8
|
+
- 1
|
9
|
+
version: 0.9.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- hpoydar
|
@@ -10,19 +15,21 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2010-
|
18
|
+
date: 2010-03-08 00:00:00 -05:00
|
14
19
|
default_executable:
|
15
20
|
dependencies:
|
16
21
|
- !ruby/object:Gem::Dependency
|
17
22
|
name: rspec
|
18
|
-
|
19
|
-
|
20
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
21
25
|
requirements:
|
22
26
|
- - ">="
|
23
27
|
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
24
30
|
version: "0"
|
25
|
-
|
31
|
+
type: :development
|
32
|
+
version_requirements: *id001
|
26
33
|
description: 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.
|
27
34
|
email: hpoydar@gmail.com
|
28
35
|
executables: []
|
@@ -54,18 +61,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
61
|
requirements:
|
55
62
|
- - ">="
|
56
63
|
- !ruby/object:Gem::Version
|
64
|
+
segments:
|
65
|
+
- 0
|
57
66
|
version: "0"
|
58
|
-
version:
|
59
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
68
|
requirements:
|
61
69
|
- - ">="
|
62
70
|
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
63
73
|
version: "0"
|
64
|
-
version:
|
65
74
|
requirements: []
|
66
75
|
|
67
76
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.3.
|
77
|
+
rubygems_version: 1.3.6
|
69
78
|
signing_key:
|
70
79
|
specification_version: 3
|
71
80
|
summary: A Ruby natural language parser for elapsed time
|