Skip to content

Instantly share code, notes, and snippets.

@KamilLelonek
Created December 8, 2014 08:36
Show Gist options
  • Save KamilLelonek/55b36aac2a965988c4ac to your computer and use it in GitHub Desktop.
Save KamilLelonek/55b36aac2a965988c4ac to your computer and use it in GitHub Desktop.
GravatarHelper that can be used directly
require 'digest/md5'
module GravatarHelper
# previous implementation
# ...
def gravatar_for_email(email)
self.class.gravatar_for_email(email)
end
end
[0] (pry) main: 0> user = User.new('[email protected]');
[1] (pry) main: 0> GravatarHelper.gravatar_for_email(user.email)
=> 'http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af'
class User
attr_reader :email
def initialize(email)
@email = email
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment