home_run 0.9.3-x86-mswin32-60 → 0.9.4-x86-mswin32-60

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.
Files changed (40) hide show
  1. data/CHANGELOG +4 -0
  2. data/README.rdoc +0 -1
  3. data/ext/date_ext/date_ext.c +192 -191
  4. data/ext/date_ext/datetime.c +12 -11
  5. data/lib/1.8/date_ext.so +0 -0
  6. data/lib/1.9/date_ext.so +0 -0
  7. data/spec/date/add_month_spec.rb +5 -0
  8. data/spec/date/add_spec.rb +5 -0
  9. data/spec/date/civil_spec.rb +5 -1
  10. data/spec/date/commercial_spec.rb +5 -0
  11. data/spec/date/conversions_spec.rb +10 -0
  12. data/spec/date/downto_spec.rb +6 -0
  13. data/spec/date/julian_spec.rb +10 -0
  14. data/spec/date/minus_month_spec.rb +5 -0
  15. data/spec/date/minus_spec.rb +5 -0
  16. data/spec/date/next_prev_spec.rb +30 -1
  17. data/spec/date/ordinal_spec.rb +5 -0
  18. data/spec/date/parse_spec.rb +6 -0
  19. data/spec/date/parsing_spec.rb +11 -0
  20. data/spec/date/step_spec.rb +6 -0
  21. data/spec/date/strptime_spec.rb +6 -0
  22. data/spec/date/succ_spec.rb +5 -0
  23. data/spec/date/today_spec.rb +5 -0
  24. data/spec/date/upto_spec.rb +7 -0
  25. data/spec/datetime/add_month_spec.rb +5 -0
  26. data/spec/datetime/add_spec.rb +5 -0
  27. data/spec/datetime/constructor_spec.rb +10 -0
  28. data/spec/datetime/conversions_spec.rb +5 -0
  29. data/spec/datetime/downto_spec.rb +6 -0
  30. data/spec/datetime/minus_month_spec.rb +5 -2
  31. data/spec/datetime/minus_spec.rb +5 -0
  32. data/spec/datetime/next_prev_spec.rb +30 -0
  33. data/spec/datetime/now_spec.rb +5 -0
  34. data/spec/datetime/parse_spec.rb +6 -0
  35. data/spec/datetime/parsing_spec.rb +11 -0
  36. data/spec/datetime/step_spec.rb +6 -0
  37. data/spec/datetime/strptime_spec.rb +6 -0
  38. data/spec/datetime/succ_spec.rb +5 -0
  39. data/spec/datetime/upto_spec.rb +6 -0
  40. 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
@@ -36,4 +36,10 @@ describe "DateTime#downto" do
36
36
  count.should == 17
37
37
  end
38
38
 
39
+ it "should keep the same class as the receiver" do
40
+ c = Class.new(DateTime)
41
+ c.jd.downto(c.jd - 2) do |d|
42
+ d.should be_kind_of(c)
43
+ end.should be_kind_of(c)
44
+ end
39
45
  end
@@ -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
@@ -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
@@ -15,4 +15,9 @@ describe "DateTime.now" do
15
15
  it "should accept an optional sg value" do
16
16
  DateTime.now(1).to_s.should == DateTime.now.to_s
17
17
  end
18
+
19
+ it "should keep the same class as the receiver" do
20
+ c = Class.new(DateTime)
21
+ c.now.should be_kind_of(c)
22
+ end
18
23
  end
@@ -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
@@ -174,4 +174,10 @@ describe "DateTime#step" do
174
174
 
175
175
  end
176
176
 
177
+ it "should keep the same class as the receiver" do
178
+ c = Class.new(DateTime)
179
+ c.jd.step(c.jd + 2) do |d|
180
+ d.should be_kind_of(c)
181
+ end.should be_kind_of(c)
182
+ end
177
183
  end
@@ -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)
@@ -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
@@ -36,4 +36,10 @@ describe "DateTime#upto" do
36
36
  count.should == 13
37
37
  end
38
38
 
39
+ it "should keep the same class as the receiver" do
40
+ c = Class.new(DateTime)
41
+ c.jd.upto(c.jd + 2) do |d|
42
+ d.should be_kind_of(c)
43
+ end.should be_kind_of(c)
44
+ end
39
45
  end
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: 61
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 3
10
- version: 0.9.3
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-09-20 00:00:00 -07:00
18
+ date: 2010-10-18 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21