0.0
No commit activity in last 3 years
No release in over 3 years
Add gravatars to your ruby project as simple as possible.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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.