american_date 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/README.rdoc +6 -5
- data/Rakefile +13 -19
- data/lib/american_date.rb +4 -4
- data/spec/american_date_spec.rb +61 -58
- metadata +12 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 639c1dccbfe0dbf670569aaffb560c53ad3dac27
|
|
4
|
+
data.tar.gz: 0e6ab6b8a1847e58c5ef5cf4d93228b0f26f61f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e730ca1a4deae09680360f844048476abb5ea396c94222933fdf7687f20c1f6469925fd80c4599825c7cc5ea27cf0f11d7fe77b503f8dec59eb02790e82f8100
|
|
7
|
+
data.tar.gz: 2c69087b54b406a9b332ad65ae9b1cb0bbef7bf2c787b49ea5b7e864158e4f0b7f1541e6f40741796171e31d881aba094afa0758e6e836766e728baf84893ba8
|
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
|
@@ -13,7 +13,8 @@ most don't handle cases where an american date format is used in
|
|
|
13
13
|
addition to a time format.
|
|
14
14
|
|
|
15
15
|
Note that this gem only handles / separated dates. It does not
|
|
16
|
-
handle - or . separated dates. This is by design
|
|
16
|
+
handle - or . separated dates. This is by design, for compatibility
|
|
17
|
+
with ruby 1.8.7.
|
|
17
18
|
|
|
18
19
|
== Design
|
|
19
20
|
|
|
@@ -26,12 +27,12 @@ and the C extension date parser (>=1.9.3).
|
|
|
26
27
|
|
|
27
28
|
== Tested ruby versions
|
|
28
29
|
|
|
29
|
-
* ruby 1.8.6, 1.8.7, 1.9.2, 1.9.3, 2.0.0
|
|
30
|
-
* rubinius 1.2.4
|
|
31
|
-
* jruby 1.6.5 (both --1.8 and --1.9 modes)
|
|
30
|
+
* ruby 1.8.6, 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.0
|
|
31
|
+
* rubinius 1.2.4, 2.2.6
|
|
32
|
+
* jruby 1.6.5, 1.7.9 (both --1.8 and --1.9 modes)
|
|
32
33
|
|
|
33
34
|
== Installation
|
|
34
|
-
|
|
35
|
+
|
|
35
36
|
ruby-american_date is distributed as a gem, and can be installed with:
|
|
36
37
|
|
|
37
38
|
gem install american_date
|
data/Rakefile
CHANGED
|
@@ -9,30 +9,24 @@ rdoc_task_class = begin
|
|
|
9
9
|
RDOC_OPTS.concat(['-f', 'hanna'])
|
|
10
10
|
RDoc::Task
|
|
11
11
|
rescue LoadError
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
begin
|
|
13
|
+
require "rake/rdoctask"
|
|
14
|
+
Rake::RDocTask
|
|
15
|
+
rescue RuntimeError
|
|
16
|
+
end
|
|
14
17
|
end
|
|
15
18
|
|
|
16
|
-
rdoc_task_class
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
begin
|
|
23
|
-
require "spec/rake/spectask"
|
|
24
|
-
spec_class = Spec::Rake::SpecTask
|
|
25
|
-
spec_files_meth = :spec_files=
|
|
26
|
-
rescue LoadError
|
|
27
|
-
# RSpec 2
|
|
28
|
-
require "rspec/core/rake_task"
|
|
29
|
-
spec_class = RSpec::Core::RakeTask
|
|
30
|
-
spec_files_meth = :pattern=
|
|
19
|
+
if rdoc_task_class
|
|
20
|
+
rdoc_task_class.new do |rdoc|
|
|
21
|
+
rdoc.rdoc_dir = "rdoc"
|
|
22
|
+
rdoc.options += RDOC_OPTS
|
|
23
|
+
rdoc.rdoc_files.add %w"lib/american_date.rb MIT-LICENSE CHANGELOG README.rdoc"
|
|
24
|
+
end
|
|
31
25
|
end
|
|
32
26
|
|
|
33
27
|
desc "Run specs"
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
task :spec do
|
|
29
|
+
sh "#{FileUtils::RUBY} -rubygems -I lib spec/american_date_spec.rb"
|
|
36
30
|
end
|
|
37
31
|
task :default=>[:spec]
|
|
38
32
|
|
data/lib/american_date.rb
CHANGED
|
@@ -22,8 +22,8 @@ if RUBY_VERSION >= '1.9'
|
|
|
22
22
|
alias parse_without_american_date parse
|
|
23
23
|
|
|
24
24
|
# Transform american dates into ISO dates before parsing.
|
|
25
|
-
def parse(string, comp=true)
|
|
26
|
-
parse_without_american_date(convert_american_to_iso(string), comp)
|
|
25
|
+
def parse(string, comp=true, start=Date::ITALY)
|
|
26
|
+
parse_without_american_date(convert_american_to_iso(string), comp, start)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -53,8 +53,8 @@ if RUBY_VERSION >= '1.9'
|
|
|
53
53
|
alias parse_without_american_date parse
|
|
54
54
|
|
|
55
55
|
# Transform american dates into ISO dates before parsing.
|
|
56
|
-
def parse(string, comp=true)
|
|
57
|
-
parse_without_american_date(convert_american_to_iso(string), comp)
|
|
56
|
+
def parse(string, comp=true, start=DateTime::ITALY)
|
|
57
|
+
parse_without_american_date(convert_american_to_iso(string), comp, start)
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
end
|
data/spec/american_date_spec.rb
CHANGED
|
@@ -1,259 +1,262 @@
|
|
|
1
1
|
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'lib', 'american_date')
|
|
2
2
|
require 'time'
|
|
3
|
+
require 'minitest/autorun'
|
|
3
4
|
|
|
4
5
|
describe "Date.parse" do
|
|
5
6
|
specify "should use american date format for dd/mm/yy" do
|
|
6
|
-
Date.parse('01/02/03', true).
|
|
7
|
+
Date.parse('01/02/03', true).must_equal Date.new(2003, 1, 2)
|
|
8
|
+
Date.parse('01/02/03', true, Date::ITALY).must_equal Date.new(2003, 1, 2)
|
|
7
9
|
end
|
|
8
10
|
|
|
9
11
|
specify "should use american date format for d/m/yy" do
|
|
10
|
-
Date.parse('1/2/03', true).
|
|
11
|
-
Date.parse('1/2/03', false).
|
|
12
|
+
Date.parse('1/2/03', true).must_equal Date.new(2003, 1, 2)
|
|
13
|
+
Date.parse('1/2/03', false).must_equal Date.new(3, 1, 2)
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
specify "should use american date format for dd/mm/yyyy" do
|
|
15
|
-
Date.parse('01/02/2003').
|
|
17
|
+
Date.parse('01/02/2003').must_equal Date.new(2003, 1, 2)
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
specify "should use american date format for dd/mm" do
|
|
19
|
-
Date.parse('01/02').
|
|
21
|
+
Date.parse('01/02').must_equal Date.new(Time.now.year, 1, 2)
|
|
20
22
|
end
|
|
21
23
|
|
|
22
24
|
specify "should use american date format for d/m" do
|
|
23
|
-
Date.parse('1/2').
|
|
25
|
+
Date.parse('1/2').must_equal Date.new(Time.now.year, 1, 2)
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
specify "should ignore preceding whitespace" do
|
|
27
|
-
Date.parse(' 01/02/2003').
|
|
29
|
+
Date.parse(' 01/02/2003').must_equal Date.new(2003, 1, 2)
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
specify "should ignore preceding weekday" do
|
|
31
|
-
Date.parse('Day 01/02/2003').
|
|
33
|
+
Date.parse('Day 01/02/2003').must_equal Date.new(2003, 1, 2)
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
specify "should work just like 1.8 does" do
|
|
35
|
-
Date.parse('10:20:30something01/02/2003else').
|
|
37
|
+
Date.parse('10:20:30something01/02/2003else').must_equal Date.new(2003, 1, 2)
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
specify "should not mismatch years" do
|
|
39
|
-
Date.parse('2003/01/02').
|
|
41
|
+
Date.parse('2003/01/02').must_equal Date.new(2003, 1, 2)
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
specify "should behave like 1.8 and only allow / as delimiters in american-style dates" do
|
|
43
|
-
Date.parse("10/11/2012").
|
|
44
|
-
Date.parse("10-11-2012").
|
|
45
|
-
Date.parse("10.11.2012").
|
|
45
|
+
Date.parse("10/11/2012").must_equal Date.new(2012, 10, 11)
|
|
46
|
+
Date.parse("10-11-2012").must_equal Date.new(2012, 11, 10)
|
|
47
|
+
Date.parse("10.11.2012").must_equal Date.new(2012, 11, 10)
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
if RUBY_VERSION > '1.9'
|
|
49
51
|
specify "should raise TypeError for invalid values" do
|
|
50
52
|
[nil, 1, 1.0, [], {}].each do |x|
|
|
51
|
-
proc{Date.parse(x)}.
|
|
53
|
+
proc{Date.parse(x)}.must_raise(TypeError)
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
specify "should handle values implicitly convertible to String" do
|
|
56
58
|
o = Object.new
|
|
57
59
|
def o.to_str() '01/02/2003' end
|
|
58
|
-
Date.parse(o).
|
|
60
|
+
Date.parse(o).must_equal Date.new(2003, 1, 2)
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
specify "should handle values implicitly convertible to String" do
|
|
62
64
|
o = Object.new
|
|
63
65
|
def o.to_str() 1 end
|
|
64
|
-
proc{Date.parse(o)}.
|
|
66
|
+
proc{Date.parse(o)}.must_raise(TypeError)
|
|
65
67
|
end
|
|
66
68
|
end
|
|
67
69
|
end
|
|
68
70
|
|
|
69
71
|
describe "DateTime.parse" do
|
|
70
72
|
specify "should use american date format for dd/mm/yy" do
|
|
71
|
-
DateTime.parse('01/02/03', true).
|
|
73
|
+
DateTime.parse('01/02/03', true).must_equal DateTime.new(2003, 1, 2)
|
|
74
|
+
DateTime.parse('01/02/03', true, DateTime::ITALY).must_equal DateTime.new(2003, 1, 2)
|
|
72
75
|
end
|
|
73
76
|
|
|
74
77
|
specify "should use american date format for d/m/yy" do
|
|
75
|
-
DateTime.parse('1/2/03', true).
|
|
76
|
-
DateTime.parse('1/2/03', false).
|
|
78
|
+
DateTime.parse('1/2/03', true).must_equal DateTime.new(2003, 1, 2)
|
|
79
|
+
DateTime.parse('1/2/03', false).must_equal DateTime.new(3, 1, 2)
|
|
77
80
|
end
|
|
78
81
|
|
|
79
82
|
specify "should use american date format for dd/mm/yyyy" do
|
|
80
|
-
DateTime.parse('01/02/2003').
|
|
83
|
+
DateTime.parse('01/02/2003').must_equal DateTime.new(2003, 1, 2)
|
|
81
84
|
end
|
|
82
85
|
|
|
83
86
|
specify "should use american date format for dd/mm" do
|
|
84
|
-
DateTime.parse('01/02').
|
|
87
|
+
DateTime.parse('01/02').must_equal DateTime.new(Time.now.year, 1, 2)
|
|
85
88
|
end
|
|
86
89
|
|
|
87
90
|
specify "should use american date format for d/m" do
|
|
88
|
-
DateTime.parse('1/2').
|
|
91
|
+
DateTime.parse('1/2').must_equal DateTime.new(Time.now.year, 1, 2)
|
|
89
92
|
end
|
|
90
93
|
|
|
91
94
|
specify "should ignore preceding whitespace" do
|
|
92
|
-
DateTime.parse(' 01/02/2003').
|
|
95
|
+
DateTime.parse(' 01/02/2003').must_equal DateTime.new(2003, 1, 2)
|
|
93
96
|
end
|
|
94
97
|
|
|
95
98
|
specify "should ignore preceding weekday" do
|
|
96
|
-
DateTime.parse('Day 01/02/2003').
|
|
99
|
+
DateTime.parse('Day 01/02/2003').must_equal Date.new(2003, 1, 2)
|
|
97
100
|
end
|
|
98
101
|
|
|
99
102
|
specify "should work with times" do
|
|
100
|
-
DateTime.parse('01/02/2003 10:20:30').
|
|
103
|
+
DateTime.parse('01/02/2003 10:20:30').must_equal DateTime.new(2003, 1, 2, 10, 20, 30)
|
|
101
104
|
end
|
|
102
105
|
|
|
103
106
|
specify "should work with times and weekdays" do
|
|
104
|
-
DateTime.parse('Day 01/02/2003 10:20:30').
|
|
107
|
+
DateTime.parse('Day 01/02/2003 10:20:30').must_equal DateTime.new(2003, 1, 2, 10, 20, 30)
|
|
105
108
|
end
|
|
106
109
|
|
|
107
110
|
specify "should work just like 1.8 does" do
|
|
108
|
-
DateTime.parse('10:20:30something01/02/2003else').
|
|
111
|
+
DateTime.parse('10:20:30something01/02/2003else').must_equal DateTime.new(2003, 1, 2, 10, 20, 30)
|
|
109
112
|
end
|
|
110
113
|
|
|
111
114
|
specify "should not mismatch years" do
|
|
112
|
-
DateTime.parse('2003/01/02').
|
|
115
|
+
DateTime.parse('2003/01/02').must_equal Date.new(2003, 1, 2)
|
|
113
116
|
end
|
|
114
117
|
|
|
115
118
|
if RUBY_VERSION > '1.9'
|
|
116
119
|
specify "should raise TypeError for invalid values" do
|
|
117
120
|
[nil, 1, 1.0, [], {}].each do |x|
|
|
118
|
-
proc{DateTime.parse(x)}.
|
|
121
|
+
proc{DateTime.parse(x)}.must_raise(TypeError)
|
|
119
122
|
end
|
|
120
123
|
end
|
|
121
124
|
|
|
122
125
|
specify "should handle values implicitly convertible to String" do
|
|
123
126
|
o = Object.new
|
|
124
127
|
def o.to_str() '01/02/2003' end
|
|
125
|
-
DateTime.parse(o).
|
|
128
|
+
DateTime.parse(o).must_equal DateTime.new(2003, 1, 2)
|
|
126
129
|
end
|
|
127
130
|
|
|
128
131
|
specify "should handle values implicitly convertible to String" do
|
|
129
132
|
o = Object.new
|
|
130
133
|
def o.to_str() 1 end
|
|
131
|
-
proc{DateTime.parse(o)}.
|
|
134
|
+
proc{DateTime.parse(o)}.must_raise(TypeError)
|
|
132
135
|
end
|
|
133
136
|
end
|
|
134
137
|
end
|
|
135
138
|
|
|
136
139
|
describe "Time.parse" do
|
|
137
140
|
specify "should use american date format for dd/mm/yy" do
|
|
138
|
-
Time.parse('01/02/03'
|
|
141
|
+
Time.parse('01/02/03').must_equal Time.local(2003, 1, 2)
|
|
139
142
|
end
|
|
140
143
|
|
|
141
144
|
specify "should use american date format for d/m/yy" do
|
|
142
|
-
Time.parse('1/2/03'
|
|
145
|
+
Time.parse('1/2/03').must_equal Time.local(2003, 1, 2)
|
|
143
146
|
end
|
|
144
147
|
|
|
145
148
|
specify "should use american date format for dd/mm/yyyy" do
|
|
146
|
-
Time.parse('01/02/2003').
|
|
149
|
+
Time.parse('01/02/2003').must_equal Time.local(2003, 1, 2)
|
|
147
150
|
end
|
|
148
151
|
|
|
149
152
|
specify "should use american date format for dd/mm" do
|
|
150
|
-
Time.parse('01/02').
|
|
153
|
+
Time.parse('01/02').must_equal Time.local(Time.now.year, 1, 2)
|
|
151
154
|
end
|
|
152
155
|
|
|
153
156
|
specify "should use american date format for d/m" do
|
|
154
|
-
Time.parse('1/2').
|
|
157
|
+
Time.parse('1/2').must_equal Time.local(Time.now.year, 1, 2)
|
|
155
158
|
end
|
|
156
159
|
|
|
157
160
|
specify "should ignore preceding whitespace" do
|
|
158
|
-
Time.parse(' 01/02/2003').
|
|
161
|
+
Time.parse(' 01/02/2003').must_equal Time.local(2003, 1, 2)
|
|
159
162
|
end
|
|
160
163
|
|
|
161
164
|
specify "should ignore preceding weekdays" do
|
|
162
|
-
Time.parse('Day 01/02/2003').
|
|
165
|
+
Time.parse('Day 01/02/2003').must_equal Time.local(2003, 1, 2)
|
|
163
166
|
end
|
|
164
167
|
|
|
165
168
|
specify "should work with times" do
|
|
166
|
-
Time.parse('01/02/2003 10:20:30').
|
|
169
|
+
Time.parse('01/02/2003 10:20:30').must_equal Time.local(2003, 1, 2, 10, 20, 30)
|
|
167
170
|
end
|
|
168
171
|
|
|
169
172
|
specify "should work with times and weekdays" do
|
|
170
|
-
Time.parse('Day 01/02/2003 10:20:30').
|
|
173
|
+
Time.parse('Day 01/02/2003 10:20:30').must_equal Time.local(2003, 1, 2, 10, 20, 30)
|
|
171
174
|
end
|
|
172
175
|
|
|
173
176
|
specify "should work with time first and date second" do
|
|
174
|
-
Time.parse('10:20:30 01/02/2003').
|
|
177
|
+
Time.parse('10:20:30 01/02/2003').must_equal Time.local(2003, 1, 2, 10, 20, 30)
|
|
175
178
|
end
|
|
176
179
|
|
|
177
180
|
specify "should work with time first and date second and weekday in the middle" do
|
|
178
|
-
Time.parse('10:20:30 Thu 01/02/2003').
|
|
181
|
+
Time.parse('10:20:30 Thu 01/02/2003').must_equal Time.local(2003, 1, 2, 10, 20, 30)
|
|
179
182
|
end
|
|
180
183
|
|
|
181
184
|
specify "should work just like 1.8 does" do
|
|
182
|
-
Time.parse('10:20:30something01/02/2003else').
|
|
185
|
+
Time.parse('10:20:30something01/02/2003else').must_equal Time.local(2003, 1, 2, 10, 20, 30)
|
|
183
186
|
end
|
|
184
187
|
|
|
185
188
|
specify "should not mismatch years" do
|
|
186
|
-
Time.parse('2003/01/02').
|
|
189
|
+
Time.parse('2003/01/02').must_equal Time.local(2003, 1, 2, 0, 0, 0)
|
|
187
190
|
end
|
|
188
191
|
|
|
189
192
|
if RUBY_VERSION > '1.9'
|
|
190
193
|
specify "should raise TypeError for invalid values" do
|
|
191
194
|
[nil, 1, 1.0, [], {}].each do |x|
|
|
192
|
-
proc{Time.parse(x)}.
|
|
195
|
+
proc{Time.parse(x)}.must_raise(TypeError)
|
|
193
196
|
end
|
|
194
197
|
end
|
|
195
198
|
|
|
196
199
|
specify "should handle values implicitly convertible to String" do
|
|
197
200
|
o = Object.new
|
|
198
201
|
def o.to_str() '01/02/2003' end
|
|
199
|
-
Time.parse(o).
|
|
202
|
+
Time.parse(o).must_equal Time.local(2003, 1, 2)
|
|
200
203
|
end
|
|
201
204
|
|
|
202
205
|
specify "should handle values implicitly convertible to String" do
|
|
203
206
|
o = Object.new
|
|
204
207
|
def o.to_str() 1 end
|
|
205
|
-
proc{Time.parse(o)}.
|
|
208
|
+
proc{Time.parse(o)}.must_raise(TypeError)
|
|
206
209
|
end
|
|
207
210
|
end
|
|
208
211
|
end
|
|
209
212
|
|
|
210
213
|
describe "Date._parse" do
|
|
211
214
|
specify "should use american date format for dd/mm/yy" do
|
|
212
|
-
Date._parse('01/02/03', true).
|
|
215
|
+
Date._parse('01/02/03', true).must_equal(:year=>2003, :mon=>1, :mday=>2)
|
|
213
216
|
end
|
|
214
217
|
|
|
215
218
|
specify "should use american date format for d/m/yy" do
|
|
216
|
-
Date._parse('1/2/03', true).
|
|
217
|
-
Date._parse('1/2/03', false).
|
|
219
|
+
Date._parse('1/2/03', true).must_equal(:year=>2003, :mon=>1, :mday=>2)
|
|
220
|
+
Date._parse('1/2/03', false).must_equal(:year=>3, :mon=>1, :mday=>2)
|
|
218
221
|
end
|
|
219
222
|
|
|
220
223
|
specify "should use american date format for dd/mm/yyyy" do
|
|
221
|
-
Date._parse('01/02/2003').
|
|
224
|
+
Date._parse('01/02/2003').must_equal(:year=>2003, :mon=>1, :mday=>2)
|
|
222
225
|
end
|
|
223
226
|
|
|
224
227
|
specify "should use american date format for dd/mm" do
|
|
225
|
-
Date._parse('01/02').
|
|
228
|
+
Date._parse('01/02').must_equal(:mon=>1, :mday=>2)
|
|
226
229
|
end
|
|
227
230
|
|
|
228
231
|
specify "should use american date format for d/m" do
|
|
229
|
-
Date._parse('1/2').
|
|
232
|
+
Date._parse('1/2').must_equal(:mon=>1, :mday=>2)
|
|
230
233
|
end
|
|
231
234
|
|
|
232
235
|
specify "should ignore preceding whitespace" do
|
|
233
|
-
Date._parse(' 01/02/2003').
|
|
236
|
+
Date._parse(' 01/02/2003').must_equal(:year=>2003, :mon=>1, :mday=>2)
|
|
234
237
|
end
|
|
235
238
|
|
|
236
239
|
specify "should work with times" do
|
|
237
|
-
DateTime._parse('01/02/2003 10:20:30').
|
|
240
|
+
DateTime._parse('01/02/2003 10:20:30').must_equal(:year=>2003, :mon=>1, :mday=>2, :hour=>10, :min=>20, :sec=>30)
|
|
238
241
|
end
|
|
239
242
|
|
|
240
243
|
if RUBY_VERSION > '1.9'
|
|
241
244
|
specify "should raise TypeError for invalid values" do
|
|
242
245
|
[nil, 1, 1.0, [], {}].each do |x|
|
|
243
|
-
proc{DateTime._parse(x)}.
|
|
246
|
+
proc{DateTime._parse(x)}.must_raise(TypeError)
|
|
244
247
|
end
|
|
245
248
|
end
|
|
246
249
|
|
|
247
250
|
specify "should handle values implicitly convertible to String" do
|
|
248
251
|
o = Object.new
|
|
249
252
|
def o.to_str() '01/02/2003' end
|
|
250
|
-
DateTime._parse(o).
|
|
253
|
+
DateTime._parse(o).must_equal(:year=>2003, :mon=>1, :mday=>2)
|
|
251
254
|
end
|
|
252
255
|
|
|
253
256
|
specify "should handle values implicitly convertible to String" do
|
|
254
257
|
o = Object.new
|
|
255
258
|
def o.to_str() 1 end
|
|
256
|
-
proc{DateTime._parse(o)}.
|
|
259
|
+
proc{DateTime._parse(o)}.must_raise(TypeError)
|
|
257
260
|
end
|
|
258
261
|
end
|
|
259
262
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: american_date
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Evans
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: American style month/day/year date parsing for ruby 1.9
|
|
14
14
|
email: code@jeremyevans.net
|
|
@@ -19,39 +19,39 @@ extra_rdoc_files:
|
|
|
19
19
|
- CHANGELOG
|
|
20
20
|
- MIT-LICENSE
|
|
21
21
|
files:
|
|
22
|
-
- MIT-LICENSE
|
|
23
22
|
- CHANGELOG
|
|
23
|
+
- MIT-LICENSE
|
|
24
24
|
- README.rdoc
|
|
25
25
|
- Rakefile
|
|
26
|
-
- spec/american_date_spec.rb
|
|
27
26
|
- lib/american_date.rb
|
|
27
|
+
- spec/american_date_spec.rb
|
|
28
28
|
homepage: https://github.com/jeremyevans/ruby-american_date
|
|
29
29
|
licenses: []
|
|
30
30
|
metadata: {}
|
|
31
31
|
post_install_message:
|
|
32
32
|
rdoc_options:
|
|
33
|
-
- --quiet
|
|
34
|
-
- --inline-source
|
|
35
|
-
- --line-numbers
|
|
36
|
-
- --title
|
|
33
|
+
- "--quiet"
|
|
34
|
+
- "--inline-source"
|
|
35
|
+
- "--line-numbers"
|
|
36
|
+
- "--title"
|
|
37
37
|
- 'american_date: American style month/day/year date parsing for ruby 1.9'
|
|
38
|
-
- --main
|
|
38
|
+
- "--main"
|
|
39
39
|
- README.rdoc
|
|
40
40
|
require_paths:
|
|
41
41
|
- lib
|
|
42
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
|
-
- -
|
|
44
|
+
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '0'
|
|
47
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
requirements:
|
|
49
|
-
- -
|
|
49
|
+
- - ">="
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
51
|
version: '0'
|
|
52
52
|
requirements: []
|
|
53
53
|
rubyforge_project:
|
|
54
|
-
rubygems_version: 2.
|
|
54
|
+
rubygems_version: 2.4.5.1
|
|
55
55
|
signing_key:
|
|
56
56
|
specification_version: 4
|
|
57
57
|
summary: American style month/day/year date parsing for ruby 1.9
|