asari 0.10.3 → 0.10.4
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/README.md +1 -0
- data/lib/asari/geography.rb +8 -4
- data/lib/asari/version.rb +1 -1
- data/spec/geography_spec.rb +2 -2
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cdd3f228844cd4684bc1807b4e75db16e30b0d5
|
4
|
+
data.tar.gz: f3d52105f098b146b060ed4a76b896bda9d84409
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74d855bf3b197fc1556010162cc060e36b1697bbb6679142d2384027c07d2f006c5b5aa94fae78d36e5dd1d3fd55f4fc3a0b7d3088f147c551f01e4ee0de2109
|
7
|
+
data.tar.gz: 798c73bc7ade26f0948b16edc869d17d6de99b837eabb6927497f58239f6f876377031be18b4daf7994f75953b7fd6eab1f414ff89c224cf42f7eb0b84a30860
|
data/README.md
CHANGED
@@ -212,6 +212,7 @@ Gem requirements/etc. should be handled by Bundler.
|
|
212
212
|
* [Emil Soman](https://github.com/emilsoman "emilsoman on GitHub")
|
213
213
|
* [Chris Vincent](https://github.com/cvincent "cvincent on GitHub")
|
214
214
|
* [Kyle Meyer](https://github.com/kaiuhl "kaiuhl on GitHub")
|
215
|
+
* [Brentan Alexander](https://github.com/brentan "brentan on GitHub")
|
215
216
|
|
216
217
|
## License
|
217
218
|
Copyright (C) 2012 by Tommy Morgan
|
data/lib/asari/geography.rb
CHANGED
@@ -77,9 +77,13 @@ class Asari
|
|
77
77
|
|
78
78
|
bottom = latitude_to_int(latitude - change_in_latitude)
|
79
79
|
top = latitude_to_int(latitude + change_in_latitude)
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
if((latitude - change_in_latitude).abs < (latitude + change_in_latitude).abs)
|
81
|
+
left = longitude_to_int(longitude - change_in_longitude, latitude - change_in_latitude)
|
82
|
+
right = longitude_to_int(longitude + change_in_longitude, latitude - change_in_latitude)
|
83
|
+
else
|
84
|
+
left = longitude_to_int(longitude - change_in_longitude, latitude + change_in_latitude)
|
85
|
+
right = longitude_to_int(longitude + change_in_longitude, latitude + change_in_latitude)
|
86
|
+
end
|
83
87
|
|
84
88
|
{ lat: (bottom.round..top.round), lng: (left.round..right.round) }
|
85
89
|
end
|
@@ -105,7 +109,7 @@ class Asari
|
|
105
109
|
end
|
106
110
|
|
107
111
|
def meters_per_degree_of_longitude(latitude)
|
108
|
-
METERS_PER_DEGREE_OF_LATITUDE * Math.cos(latitude)
|
112
|
+
METERS_PER_DEGREE_OF_LATITUDE * Math.cos(latitude * ( Math::PI / 180 ))
|
109
113
|
end
|
110
114
|
end
|
111
115
|
end
|
data/lib/asari/version.rb
CHANGED
data/spec/geography_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe Asari::Geography do
|
|
7
7
|
describe "#degrees_to_int" do
|
8
8
|
it "converts standard lat and lng to integers" do
|
9
9
|
result = convert.degrees_to_int(lat: 45.52, lng: 122.68)
|
10
|
-
expect(result).to eq({ lat: 2506271416, lng:
|
10
|
+
expect(result).to eq({ lat: 2506271416, lng: 2356862483 })
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -24,7 +24,7 @@ describe Asari::Geography do
|
|
24
24
|
result = convert.coordinate_box(lat: 45.52, lng: 122.682, meters: 5000)
|
25
25
|
expect(result).to eq({
|
26
26
|
lat: 2505771415..2506771417,
|
27
|
-
lng:
|
27
|
+
lng: 2358261557..2359262357
|
28
28
|
})
|
29
29
|
end
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommy Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -84,8 +84,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
86
|
rubyforge_project: asari
|
87
|
-
rubygems_version: 2.1.
|
87
|
+
rubygems_version: 2.1.11
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: Asari is a Ruby interface for AWS CloudSearch.
|
91
|
-
test_files:
|
91
|
+
test_files:
|
92
|
+
- spec/active_record_spec.rb
|
93
|
+
- spec/asari_spec.rb
|
94
|
+
- spec/collection_spec.rb
|
95
|
+
- spec/conditionals_spec.rb
|
96
|
+
- spec/documents_spec.rb
|
97
|
+
- spec/geography_spec.rb
|
98
|
+
- spec/search_spec.rb
|