chronic_duration 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/VERSION +1 -1
- data/chronic_duration.gemspec +3 -3
- data/lib/chronic_duration.rb +2 -1
- data/spec/chronic_duration_spec.rb +2 -1
- metadata +18 -9
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.1
|
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.9.
|
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"]
|
12
|
-
s.date = %q{2010-
|
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 = [
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.homepage = %q{http://github.com/hpoydar/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: 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
|
@@ -9,19 +14,21 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-03-09 00:00:00 -05:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
23
29
|
version: "0"
|
24
|
-
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
25
32
|
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.
|
26
33
|
email: hpoydar@gmail.com
|
27
34
|
executables: []
|
@@ -53,18 +60,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
60
|
requirements:
|
54
61
|
- - ">="
|
55
62
|
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
56
65
|
version: "0"
|
57
|
-
version:
|
58
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
67
|
requirements:
|
60
68
|
- - ">="
|
61
69
|
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
62
72
|
version: "0"
|
63
|
-
version:
|
64
73
|
requirements: []
|
65
74
|
|
66
75
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.3.
|
76
|
+
rubygems_version: 1.3.6
|
68
77
|
signing_key:
|
69
78
|
specification_version: 3
|
70
79
|
summary: A Ruby natural language parser for elapsed time
|