graticule 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +3 -0
- data/lib/graticule/geocoder/local_search_maps.rb +2 -2
- data/lib/graticule/location.rb +6 -7
- data/lib/graticule/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG.txt
CHANGED
@@ -20,10 +20,10 @@ module Graticule #:nodoc:
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def map_attributes(location)
|
23
|
-
|
24
|
-
mapping = {}
|
23
|
+
mapping = {:street => :address, :locality => :city, :region => :state, :postal_code => :zip}
|
25
24
|
mapping.keys.inject({}) do |result,attribute|
|
26
25
|
result[mapping[attribute]] = location.attributes[attribute]
|
26
|
+
result
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
data/lib/graticule/location.rb
CHANGED
@@ -16,7 +16,7 @@ module Graticule
|
|
16
16
|
|
17
17
|
def attributes
|
18
18
|
[:latitude, :longitude, :street, :locality, :region, :postal_code, :country].inject({}) do |result,attr|
|
19
|
-
result[attr] = self.send(attr)
|
19
|
+
result[attr] = self.send(attr) unless self.send(attr).blank?
|
20
20
|
result
|
21
21
|
end
|
22
22
|
end
|
@@ -26,16 +26,15 @@ module Graticule
|
|
26
26
|
[latitude, longitude]
|
27
27
|
end
|
28
28
|
|
29
|
-
def ==(
|
30
|
-
|
31
|
-
object.respond_to?(m) && self.send(m) == object.send(m)
|
32
|
-
end
|
29
|
+
def ==(other)
|
30
|
+
other.respond_to?(:attributes) ? attributes == other.attributes : false
|
33
31
|
end
|
34
32
|
|
35
33
|
# Calculate the distance to another location. See the various Distance formulas
|
36
34
|
# for more information
|
37
|
-
def distance_to(destination,
|
38
|
-
|
35
|
+
def distance_to(destination, options = {})
|
36
|
+
options = {:formula => :haversine, :units => :miles}.merge(options)
|
37
|
+
"Graticule::Distance::#{options[:formula].to_s.titleize}".constantize.distance(self, destination, options[:units])
|
39
38
|
end
|
40
39
|
|
41
40
|
# Where would I be if I dug through the center of the earth?
|
data/lib/graticule/version.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: graticule
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2007-03-
|
6
|
+
version: 0.2.2
|
7
|
+
date: 2007-03-27 00:00:00 -04:00
|
8
8
|
summary: API for using all the popular geocoding services.
|
9
9
|
require_paths:
|
10
10
|
- lib
|