Skip to content

Instantly share code, notes, and snippets.

@scottburton11
Created March 6, 2012 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottburton11/1989919 to your computer and use it in GitHub Desktop.
Save scottburton11/1989919 to your computer and use it in GitHub Desktop.
class GeocodesProfile
def self.for_profile(profile, geocoder = PostalGeocoder)
new(profile, geocoder).perform
end
attr_reader :profile
def initialize(profile, geocoder = PostalGeocoder)
@profile = :profile
end
def perform
@profile.latitude, @profile.longitude = geocode(@profile.address_postal_code)
end
private
def geocode(postal_code)
geocoder.geocode(postal_code)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment