Sha256: ce47ef187e41689b196b469cdaed255b169e972214ba0f3901169179aee5f4cd
Contents?: true
Size: 792 Bytes
Versions: 1
Compression:
Stored size: 792 Bytes
Contents
require "geomancer/version" module Geomancer # Your code goes here... def self.configure(engine, opts={}) @engine = engine @options = opts case @engine when :zip_code then require_relative './geomancer/zip_code' else require 'geocoder' Geocoder.configure(engine => opts) end end def self.geolocate address if !@engine warn("No configuration provided. Defaulting to zip code geolocator") configure(:zip_code) end case @engine when :zip_code then Geomancer::ZipCode.geolocate(address) else results = Geocoder.search(address) return nil if results.empty? first_result = results.first {:latitude => first_result.latitude, :longitude => first_result.longitude} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geomancer-0.6.0 | lib/geomancer.rb |