geo_calc 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.5.3
@@ -45,8 +45,8 @@ class GeoPoint
45
45
  @lat = value.to_lat
46
46
  end
47
47
 
48
- def lon= value
49
- @lon = lon.to_lng
48
+ def lon= value
49
+ @lon = value.to_lng
50
50
  end
51
51
 
52
52
  (Symbol.lng_symbols - [:lon]).each do |sym|
@@ -55,6 +55,7 @@ class GeoPoint
55
55
  alias_method :#{sym}=, :lon=
56
56
  }
57
57
  end
58
+ alias_method :to_lng, :lng
58
59
 
59
60
  (Symbol.lat_symbols - [:lat]).each do |sym|
60
61
  class_eval %{
@@ -62,6 +63,7 @@ class GeoPoint
62
63
  alias_method :#{sym}=, :lat=
63
64
  }
64
65
  end
66
+ alias_method :to_lat, :lat
65
67
 
66
68
  def [] key
67
69
  case key
@@ -174,6 +174,12 @@ describe GeoPoint do
174
174
  @p1.latitude.should == 50
175
175
  end
176
176
  end
177
+
178
+ describe '#to_lat (alias)' do
179
+ it 'should return latitude' do
180
+ @p1.to_lat.should == 50
181
+ end
182
+ end
177
183
  end
178
184
 
179
185
  describe '#lat=' do
@@ -199,6 +205,62 @@ describe GeoPoint do
199
205
  end
200
206
  end
201
207
 
208
+ describe '#lon' do
209
+ before :each do
210
+ @p1 = GeoPoint.new 5, 50
211
+ end
212
+
213
+ it 'should return longitude' do
214
+ @p1.lon.should == 50
215
+ end
216
+
217
+ it 'should return longitude (via lng)' do
218
+ @p1.lng.should == 50
219
+ end
220
+
221
+ describe '#longitude (alias)' do
222
+ it 'should return longitude' do
223
+ @p1.longitude.should == 50
224
+ end
225
+ end
226
+
227
+ describe '#to_lng (alias)' do
228
+ it 'should return latitude' do
229
+ @p1.to_lng.should == 50
230
+ end
231
+ end
232
+ end
233
+
234
+ describe '#lon=' do
235
+ before :each do
236
+ @p1 = GeoPoint.new 5, 50
237
+ end
238
+
239
+ it 'should set new longitude' do
240
+ @p1.lat.should == 5
241
+ @p1.lon = 60
242
+ @p1.lon.should == 60
243
+ end
244
+
245
+ it 'should return longitude (via lng)' do
246
+ @p1.lng = 70
247
+ @p1.lng.should == 70
248
+ end
249
+
250
+ it 'should set new latitude within allowed range' do
251
+ @p1.lon = 520
252
+ @p1.longitude.should be_between(-180, 180)
253
+ end
254
+
255
+ describe '#latitude (alias)' do
256
+ it 'should set latitude' do
257
+ @p1.longitude = 72
258
+ @p1.longitude.should == 72
259
+ end
260
+ end
261
+ end
262
+
263
+
202
264
  describe '#[]' do
203
265
  before :each do
204
266
  @p1 = GeoPoint.new 50, 5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_calc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-13 00:00:00.000000000Z
12
+ date: 2011-05-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2157580520 !ruby/object:Gem::Requirement
16
+ requirement: &2161529760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,32 +21,32 @@ dependencies:
21
21
  version: 2.5.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2157580520
24
+ version_requirements: *2161529760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &2157580040 !ruby/object:Gem::Requirement
27
+ requirement: &2161528940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ~>
30
+ - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 1.0.0
32
+ version: '1'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2157580040
35
+ version_requirements: *2161528940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &2157579560 !ruby/object:Gem::Requirement
38
+ requirement: &2161528040 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
- - - ~>
41
+ - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.5.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2157579560
46
+ version_requirements: *2161528040
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rcov
49
- requirement: &2157579080 !ruby/object:Gem::Requirement
49
+ requirement: &2161524740 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,18 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2157579080
57
+ version_requirements: *2161524740
58
+ - !ruby/object:Gem::Dependency
59
+ name: rake
60
+ requirement: &2161524140 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0.9'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2161524140
58
69
  description: Geo calculations in ruby and javascript
59
70
  email: kmandrup@gmail.com
60
71
  executables: []
@@ -95,6 +106,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
106
  - - ! '>='
96
107
  - !ruby/object:Gem::Version
97
108
  version: '0'
109
+ segments:
110
+ - 0
111
+ hash: -3503624259360642159
98
112
  required_rubygems_version: !ruby/object:Gem::Requirement
99
113
  none: false
100
114
  requirements:
@@ -107,9 +121,4 @@ rubygems_version: 1.8.0
107
121
  signing_key:
108
122
  specification_version: 3
109
123
  summary: Geo calculation library
110
- test_files:
111
- - spec/geo_calc/calculations_spec.rb
112
- - spec/geo_calc/core_ext_spec.rb
113
- - spec/geo_calc/geo_point_spec.rb
114
- - spec/geo_calc/geo_spec.rb
115
- - spec/spec_helper.rb
124
+ test_files: []