home_run 0.9.3-x86-mswin32-60 → 0.9.4-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/README.rdoc +0 -1
- data/ext/date_ext/date_ext.c +192 -191
- data/ext/date_ext/datetime.c +12 -11
- data/lib/1.8/date_ext.so +0 -0
- data/lib/1.9/date_ext.so +0 -0
- data/spec/date/add_month_spec.rb +5 -0
- data/spec/date/add_spec.rb +5 -0
- data/spec/date/civil_spec.rb +5 -1
- data/spec/date/commercial_spec.rb +5 -0
- data/spec/date/conversions_spec.rb +10 -0
- data/spec/date/downto_spec.rb +6 -0
- data/spec/date/julian_spec.rb +10 -0
- data/spec/date/minus_month_spec.rb +5 -0
- data/spec/date/minus_spec.rb +5 -0
- data/spec/date/next_prev_spec.rb +30 -1
- data/spec/date/ordinal_spec.rb +5 -0
- data/spec/date/parse_spec.rb +6 -0
- data/spec/date/parsing_spec.rb +11 -0
- data/spec/date/step_spec.rb +6 -0
- data/spec/date/strptime_spec.rb +6 -0
- data/spec/date/succ_spec.rb +5 -0
- data/spec/date/today_spec.rb +5 -0
- data/spec/date/upto_spec.rb +7 -0
- data/spec/datetime/add_month_spec.rb +5 -0
- data/spec/datetime/add_spec.rb +5 -0
- data/spec/datetime/constructor_spec.rb +10 -0
- data/spec/datetime/conversions_spec.rb +5 -0
- data/spec/datetime/downto_spec.rb +6 -0
- data/spec/datetime/minus_month_spec.rb +5 -2
- data/spec/datetime/minus_spec.rb +5 -0
- data/spec/datetime/next_prev_spec.rb +30 -0
- data/spec/datetime/now_spec.rb +5 -0
- data/spec/datetime/parse_spec.rb +6 -0
- data/spec/datetime/parsing_spec.rb +11 -0
- data/spec/datetime/step_spec.rb +6 -0
- data/spec/datetime/strptime_spec.rb +6 -0
- data/spec/datetime/succ_spec.rb +5 -0
- data/spec/datetime/upto_spec.rb +6 -0
- metadata +4 -4
@@ -9,6 +9,11 @@ describe "DateTime conversions" do
|
|
9
9
|
DateTime.new(2008, 1, 1).new_offset(0.5).should == DateTime.new(2008, 1, 1)
|
10
10
|
end
|
11
11
|
|
12
|
+
it "should keep the same class as the receiver" do
|
13
|
+
c = Class.new(DateTime)
|
14
|
+
c.jd.new_offset.should be_kind_of(c)
|
15
|
+
end
|
16
|
+
|
12
17
|
ruby_version_is "" ... "1.9" do
|
13
18
|
it "#newof should be a separate datetime with a modified offset" do
|
14
19
|
DateTime.new(2008, 1, 1).newof(0.5).to_s.should == DateTime.new(2008, 1, 1, 12, 0, 0, 0.5).to_s
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require File.expand_path('../../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe "DateTime#<<" do
|
4
|
-
|
5
4
|
it "should substract a number of months from a date" do
|
6
5
|
(DateTime.civil(2007, 12, 27) << 10).should == DateTime.civil(2007,2,27)
|
7
6
|
(DateTime.commercial(2007, 45, 5) << 10).should == DateTime.commercial(2007,2,2)
|
@@ -16,10 +15,14 @@ describe "DateTime#<<" do
|
|
16
15
|
d.should == DateTime.civil(2008, 2, 29)
|
17
16
|
end
|
18
17
|
|
18
|
+
it "should keep the same class as the receiver" do
|
19
|
+
c = Class.new(DateTime)
|
20
|
+
c.jd.<<(10).should be_kind_of(c)
|
21
|
+
end
|
22
|
+
|
19
23
|
it "should raise an error on non numeric parameters" do
|
20
24
|
lambda { DateTime.civil(2007,2,27) << "hello" }.should raise_error(TypeError)
|
21
25
|
lambda { DateTime.civil(2007,2,27) << DateTime.new }.should raise_error(TypeError)
|
22
26
|
lambda { DateTime.civil(2007,2,27) << Object.new }.should raise_error(TypeError)
|
23
27
|
end
|
24
|
-
|
25
28
|
end
|
data/spec/datetime/minus_spec.rb
CHANGED
@@ -16,6 +16,11 @@ describe "DateTime#-" do
|
|
16
16
|
(DateTime.ordinal(2008, 325, 6) - 315.25).should == DateTime.ordinal(2008, 10)
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should keep the same class as the receiver" do
|
20
|
+
c = Class.new(DateTime)
|
21
|
+
c.jd.-(10).should be_kind_of(c)
|
22
|
+
end
|
23
|
+
|
19
24
|
it "should substract a negative number of days from a DateTime" do
|
20
25
|
d = DateTime.civil(2007, 4, 19).-(-13)
|
21
26
|
d.should == DateTime.civil(2007, 5 ,2)
|
@@ -18,6 +18,11 @@ ruby_version_is "1.9" do
|
|
18
18
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).next_day).day_fraction.should == 0.5
|
19
19
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).next_day).offset.should == 0.5
|
20
20
|
end
|
21
|
+
|
22
|
+
it "should keep the same class as the receiver" do
|
23
|
+
c = Class.new(DateTime)
|
24
|
+
c.jd.next_day.should be_kind_of(c)
|
25
|
+
end
|
21
26
|
end
|
22
27
|
|
23
28
|
describe "DateTime#prev_day" do
|
@@ -37,6 +42,11 @@ ruby_version_is "1.9" do
|
|
37
42
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).prev_day).day_fraction.should == 0.5
|
38
43
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).prev_day).offset.should == 0.5
|
39
44
|
end
|
45
|
+
|
46
|
+
it "should keep the same class as the receiver" do
|
47
|
+
c = Class.new(DateTime)
|
48
|
+
c.jd.prev_day.should be_kind_of(c)
|
49
|
+
end
|
40
50
|
end
|
41
51
|
|
42
52
|
describe "DateTime#next_month" do
|
@@ -62,6 +72,11 @@ ruby_version_is "1.9" do
|
|
62
72
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).next_month).day_fraction.should == 0.5
|
63
73
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).next_month).offset.should == 0.5
|
64
74
|
end
|
75
|
+
|
76
|
+
it "should keep the same class as the receiver" do
|
77
|
+
c = Class.new(DateTime)
|
78
|
+
c.jd.next_month.should be_kind_of(c)
|
79
|
+
end
|
65
80
|
end
|
66
81
|
|
67
82
|
describe "DateTime#prev_month" do
|
@@ -87,6 +102,11 @@ ruby_version_is "1.9" do
|
|
87
102
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).prev_month).day_fraction.should == 0.5
|
88
103
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).prev_month).offset.should == 0.5
|
89
104
|
end
|
105
|
+
|
106
|
+
it "should keep the same class as the receiver" do
|
107
|
+
c = Class.new(DateTime)
|
108
|
+
c.jd.prev_month.should be_kind_of(c)
|
109
|
+
end
|
90
110
|
end
|
91
111
|
|
92
112
|
describe "DateTime#next_year" do
|
@@ -110,6 +130,11 @@ ruby_version_is "1.9" do
|
|
110
130
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).next_year).day_fraction.should == 0.5
|
111
131
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).next_year).offset.should == 0.5
|
112
132
|
end
|
133
|
+
|
134
|
+
it "should keep the same class as the receiver" do
|
135
|
+
c = Class.new(DateTime)
|
136
|
+
c.jd.next_year.should be_kind_of(c)
|
137
|
+
end
|
113
138
|
end
|
114
139
|
|
115
140
|
describe "DateTime#prev_year" do
|
@@ -133,6 +158,11 @@ ruby_version_is "1.9" do
|
|
133
158
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).prev_year).day_fraction.should == 0.5
|
134
159
|
(DateTime.civil(2007,2,27, 12, 0, 0, 0.5).prev_year).offset.should == 0.5
|
135
160
|
end
|
161
|
+
|
162
|
+
it "should keep the same class as the receiver" do
|
163
|
+
c = Class.new(DateTime)
|
164
|
+
c.jd.prev_year.should be_kind_of(c)
|
165
|
+
end
|
136
166
|
end
|
137
167
|
|
138
168
|
end
|
data/spec/datetime/now_spec.rb
CHANGED
data/spec/datetime/parse_spec.rb
CHANGED
@@ -18,6 +18,12 @@ describe "DateTime.parse" do
|
|
18
18
|
DateTime.parse.should == DateTime.jd
|
19
19
|
end
|
20
20
|
|
21
|
+
it "should keep the same class as the receiver" do
|
22
|
+
c = Class.new(DateTime)
|
23
|
+
c.parse.should be_kind_of(c)
|
24
|
+
c.parse('2008-10-11').should be_kind_of(c)
|
25
|
+
end
|
26
|
+
|
21
27
|
it "can't handle a empty string" do
|
22
28
|
lambda{ DateTime.parse("") }.should raise_error(ArgumentError)
|
23
29
|
end
|
@@ -77,5 +77,16 @@ ruby_version_is "1.9" do
|
|
77
77
|
it ".xmlschema should parse an ISO8601 format" do
|
78
78
|
DateTime.xmlschema("2009-01-02T03:04:05+12:00").should == DateTime.new(2009, 1, 2, 3, 4, 5, 0.5)
|
79
79
|
end
|
80
|
+
|
81
|
+
it "should keep the same class as the receiver" do
|
82
|
+
c = Class.new(DateTime)
|
83
|
+
c.httpdate("Fri, 02 Jan 2009 00:00:00 GMT").should be_kind_of(c)
|
84
|
+
c.iso8601("2009-01-02").should be_kind_of(c)
|
85
|
+
c.jisx0301("H21.01.02").should be_kind_of(c)
|
86
|
+
c.rfc2822("Fri, 2 Jan 2009 00:00:00 +0000").should be_kind_of(c)
|
87
|
+
c.rfc822("Fri, 2 Jan 2009 00:00:00 +0000").should be_kind_of(c)
|
88
|
+
c.rfc3339("2009-01-02T00:00:00+00:00").should be_kind_of(c)
|
89
|
+
c.xmlschema("2009-01-02").should be_kind_of(c)
|
90
|
+
end
|
80
91
|
end
|
81
92
|
end
|
data/spec/datetime/step_spec.rb
CHANGED
@@ -21,6 +21,12 @@ describe "DateTime.strptime" do
|
|
21
21
|
DateTime.strptime("2000-04-06T10:11:12+00:00").should == DateTime.civil(2000, 4, 6, 10, 11, 12)
|
22
22
|
end
|
23
23
|
|
24
|
+
it "should keep the same class as the receiver" do
|
25
|
+
c = Class.new(DateTime)
|
26
|
+
c.strptime.should be_kind_of(c)
|
27
|
+
c.strptime('2008-10-11', '%Y-%m-%d').should be_kind_of(c)
|
28
|
+
end
|
29
|
+
|
24
30
|
it "should be able to parse the hour in a 24 hour clock with leading zero" do
|
25
31
|
DateTime.strptime("10", '%H').should == DateTime.civil(@t.year, @t.mon, @t.day, 10, 0, 0)
|
26
32
|
DateTime.strptime("09", '%H').should == DateTime.civil(@t.year, @t.mon, @t.day, 9, 0, 0)
|
data/spec/datetime/succ_spec.rb
CHANGED
@@ -14,6 +14,11 @@ describe "DateTime#succ" do
|
|
14
14
|
ds.succ.should == DateTime.ordinal(2009, 1)
|
15
15
|
end
|
16
16
|
|
17
|
+
it "should keep the same class as the receiver" do
|
18
|
+
c = Class.new(DateTime)
|
19
|
+
c.jd.succ.should be_kind_of(c)
|
20
|
+
end
|
21
|
+
|
17
22
|
it "should be aliased as next" do
|
18
23
|
DateTime.civil(2008, 10, 11).next.should == DateTime.civil(2008, 10, 12)
|
19
24
|
end
|
data/spec/datetime/upto_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: home_run
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
11
11
|
platform: x86-mswin32-60
|
12
12
|
authors:
|
13
13
|
- Jeremy Evans
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-18 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|