graticule 0.2.1 → 0.2.2

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.
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,6 @@
1
+ 0.2.2 (2007-03-27)
2
+ * fixed LocalSearchMaps
3
+
1
4
  0.2.1 (2007-03-19)
2
5
  * fixed error in command line interface
3
6
 
@@ -20,10 +20,10 @@ module Graticule #:nodoc:
20
20
  private
21
21
 
22
22
  def map_attributes(location)
23
- #mapping = {:street => :address, :locality => :city, :region => :state, :postal_code => :zip}
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
 
@@ -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) if 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 ==(object)
30
- super(object) || [:latitude, :longitude, :street, :locality, :region, :postal_code, :country, :precision].all? do |m|
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, units = :miles, formula = :haversine)
38
- "Graticule::Distance::#{formula.to_s.titleize}".constantize.distance(self, destination)
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?
@@ -2,7 +2,7 @@ module Graticule #:nodoc:
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.1
7
- date: 2007-03-19 00:00:00 -04:00
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