Skip to content
Snippets Groups Projects
Commit a70042a6 authored by Alex Reisner's avatar Alex Reisner
Browse files

Maxmind Local result should define #coordinates

instead of #latitude and #longitude. This fixes #613.
parent 076521a2
No related branches found
No related tags found
No related merge requests found
...@@ -2,17 +2,14 @@ require 'geocoder/results/base' ...@@ -2,17 +2,14 @@ require 'geocoder/results/base'
module Geocoder::Result module Geocoder::Result
class MaxmindLocal < Base class MaxmindLocal < Base
def address(format = :full) def address(format = :full)
s = state.to_s == "" ? "" : ", #{state}" s = state.to_s == "" ? "" : ", #{state}"
"#{city}#{s} #{postal_code}, #{country}".sub(/^[ ,]*/, "") "#{city}#{s} #{postal_code}, #{country}".sub(/^[ ,]*/, "")
end end
def latitude def coordinates
@data[:latitude] [@data[:latitude], @data[:longitude]]
end
def longitude
@data[:longitude]
end end
def city def city
...@@ -49,4 +46,4 @@ module Geocoder::Result ...@@ -49,4 +46,4 @@ module Geocoder::Result
end end
end end
end end
end end
\ No newline at end of file
...@@ -18,6 +18,7 @@ class MaxmindLocalTest < GeocoderTestCase ...@@ -18,6 +18,7 @@ class MaxmindLocalTest < GeocoderTestCase
assert_equal '94043', result.postal_code assert_equal '94043', result.postal_code
assert_equal 37.41919999999999, result.latitude assert_equal 37.41919999999999, result.latitude
assert_equal -122.0574, result.longitude assert_equal -122.0574, result.longitude
assert_equal [37.41919999999999, -122.0574], result.coordinates
end end
def test_loopback def test_loopback
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment