Created
September 17, 2009 20:57
Revisions
-
jferris created this gist
Sep 17, 2009 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ module GeoKit module Geocoders class FakeGeocoder < Geocoder def self.locations @locations ||= {} end def self.geocode(location) loc = GeoLoc.new if locations.key?(location) loc.lat, loc.lng = *locations.fetch(location) loc.success = true end loc end def self.[](key) locations[key] end def self.[]=(key, value) locations[key] = value end def self.clear locations.clear end def self.add_location_away_from(origin, options) bounds = GeoKit::Bounds.from_point_and_radius(origin, options[:distance]) locations.store(options[:location], [bounds.sw.lat, bounds.center.lng]) end end end end