home_run 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.5 (2012-12-22)
2
+
3
+ * Handle DateTime.jd with a single float argument (jeremyevans)
4
+
1
5
  === 1.0.4 (2011-09-02)
2
6
 
3
7
  * Handle time zone offsets given as strings in the constructors (jeremyevans) (#37)
@@ -743,6 +743,9 @@ static VALUE rhrdt_s_jd(int argc, VALUE *argv, VALUE klass) {
743
743
  minute = NUM2LONG(argv[2]);
744
744
  case 2:
745
745
  hour = NUM2LONG(argv[1]);
746
+ if (TYPE(argv[0]) == T_FLOAT) {
747
+ rb_raise(rb_eArgError, "can't use float for first argument if providing multiple arguments");
748
+ }
746
749
  case 1:
747
750
  dt->jd = NUM2LONG(argv[0]);
748
751
  break;
@@ -754,7 +757,11 @@ static VALUE rhrdt_s_jd(int argc, VALUE *argv, VALUE klass) {
754
757
  RHR_CHECK_JD(dt)
755
758
  dt->flags = RHR_HAVE_JD;
756
759
  rhrdt__set_time(dt, hour, minute, second, offset);
757
- return rdt;
760
+ if (TYPE(argv[0]) == T_FLOAT) {
761
+ return rhrdt__add_days(rdt, NUM2DBL(argv[0]) - NUM2LONG(argv[0]));
762
+ } else {
763
+ return rdt;
764
+ }
758
765
  }
759
766
 
760
767
  /* call-seq:
@@ -72,6 +72,19 @@ describe "DateTime constructors" do
72
72
  d.offset.should == 1/24.0
73
73
  end
74
74
 
75
+ it ".jd handles a fractional date as first argument" do
76
+ d = DateTime.jd(2000.5)
77
+ d.jd.should == 2000
78
+ d.hour.should == 12
79
+ d.min.should == 0
80
+ d.sec.should == 0
81
+ d.offset.should == 0
82
+ end
83
+
84
+ it ".jd should raise an error if given a float as first argument and any additional arguments" do
85
+ proc{DateTime.jd(2000.5, 1)}.should raise_error(ArgumentError)
86
+ end
87
+
75
88
  it ".jd should have defaults and an optional sg value" do
76
89
  DateTime.jd.should == DateTime.jd(0, 0, 0, 0, 0)
77
90
  DateTime.jd(0).should == DateTime.jd(0, 0, 0, 0, 0)
metadata CHANGED
@@ -1,39 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: home_run
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 4
10
- version: 1.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.5
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeremy Evans
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-09-02 00:00:00 -07:00
19
- default_executable:
12
+ date: 2012-02-21 00:00:00.000000000 Z
20
13
  dependencies: []
14
+ description: ! 'home_run is an implementation of ruby''s Date/DateTime classes in
15
+ C,
21
16
 
22
- description: |
23
- home_run is an implementation of ruby's Date/DateTime classes in C,
24
17
  with much better performance (20-200x) than the version in the
18
+
25
19
  standard library, while being almost completely compatible.
26
20
 
21
+ '
27
22
  email: code@jeremyevans.net
28
- executables:
23
+ executables:
29
24
  - home_run
30
- extensions:
25
+ extensions:
31
26
  - ext/date_ext/extconf.rb
32
- extra_rdoc_files:
27
+ extra_rdoc_files:
33
28
  - README.rdoc
34
29
  - CHANGELOG
35
30
  - LICENSE
36
- files:
31
+ files:
37
32
  - LICENSE
38
33
  - CHANGELOG
39
34
  - README.rdoc
@@ -120,47 +115,35 @@ files:
120
115
  - bench/dt_garbage_bench.rb
121
116
  - bench/cpu_bench_util.rb
122
117
  - bench/parser_bench.rb
123
- has_rdoc: true
124
118
  homepage: http://github.com/jeremyevans/home_run
125
119
  licenses: []
126
-
127
120
  post_install_message:
128
- rdoc_options:
121
+ rdoc_options:
129
122
  - --quiet
130
123
  - --line-numbers
131
124
  - --inline-source
132
125
  - --title
133
- - "home_run: Fast Date/DateTime classes for ruby"
126
+ - ! 'home_run: Fast Date/DateTime classes for ruby'
134
127
  - --main
135
128
  - README.rdoc
136
- require_paths:
129
+ require_paths:
137
130
  - lib
138
- required_ruby_version: !ruby/object:Gem::Requirement
131
+ required_ruby_version: !ruby/object:Gem::Requirement
139
132
  none: false
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- hash: 59
144
- segments:
145
- - 1
146
- - 8
147
- - 6
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
148
136
  version: 1.8.6
149
- required_rubygems_version: !ruby/object:Gem::Requirement
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
138
  none: false
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- hash: 3
155
- segments:
156
- - 0
157
- version: "0"
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
158
143
  requirements: []
159
-
160
144
  rubyforge_project:
161
- rubygems_version: 1.3.7
145
+ rubygems_version: 1.8.11
162
146
  signing_key:
163
147
  specification_version: 3
164
148
  summary: Fast Date/DateTime classes for ruby
165
149
  test_files: []
166
-