Created
March 6, 2012 23:58
-
-
Save scottburton11/1989919 to your computer and use it in GitHub Desktop.
This file contains 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 characters
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