Add gravatars to your ruby project as simple as possible.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
simple_gravatar.gemspec

README.md

SimpleGravatar Build Status Code Climate Code Climate Coverage Dependency Status Gem Version

Add gravatars to your ruby project as simple as possible.

Installation

Add it to your Gemfile and run the bundle command:

gem 'simple_gravatar'

Usage

Include de module where you want to use it:

class UserDecorator
  include SimpleGravatar

  def initialize(user)
    @user = user
  end

  def gravatar
    gravatar_url @user.email
  end
end

Using in rails

Include the module in ActionView::Base, let's say, in config/initializers/simple_gravatar.rb:

ActionView::Base.send(:include, SimpleGravatar) if defined? ActionView::Base  

and use it anywhere in your views:

<%= image_tag gravatar_url('patriciomacadden@gmail.com') %>

Using in sinatra

Include the module as a helper:

helpers SimpleGravatar

get '/' do
  gravatar_url 'patriciomacadden@gmail.com'
end

Available options

All available options are the specified by Gravatar API documentation.

Contributing

  1. Fork it
  2. Create a branch (git checkout -b my_awesome_branch)
  3. Commit your changes (git commit -am "Added some magic")
  4. Push to the branch (git push origin my_awesome_branch)
  5. Send pull request

License

See the LICENSE.