Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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