Skip to content

Instantly share code, notes, and snippets.

@natebird
Forked from Arcath/gist:481321
Created December 13, 2010 12:52
Show Gist options
  • Save natebird/738957 to your computer and use it in GitHub Desktop.
Save natebird/738957 to your computer and use it in GitHub Desktop.
def gravatar_url(email,options = {})
require 'digest/md5'
hash = Digest::MD5.hexdigest(email)
url = "http://www.gravatar.com/avatar/#{hash}"
options.each do |option|
option == options.first ? url+="?" : url+="&"
key = option[0].to_s
value = option[1].to_s
url+=key + "=" + value
end
url
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment