Module | Gravatarify::Helper |
In: |
lib/gravatarify/helper.rb
|
Provides the two available helpers: `gravatar_attrs` and `gravatar_tag`.
The helper should be loaded as helper for your specific view framework:
# e.g. for Sinatra helpers Gravatarify::Helper # or include for Haml Haml::Helpers.send(:include, Gravatarify::Helper)
Helper method for HAML to return a neat hash to be used as attributes in an image tag.
Now it‘s as simple as doing something like:
%img{ gravatar_attrs(@user.mail, :size => 20) }/
This is also the base method for gravatar_tag.
@param [String, email, mail, gravatar_url] email a string or an object used
to generate to gravatar url for.
@param [Symbol, Hash] *params other gravatar or html options for building the resulting
hash.
@return [Hash] all html attributes required to build an img tag.
Takes care of creating an <img/>-tag based on a gravatar url, it no longer makes use of any Rails helper, so is totally useable in any other library.
@param [String, email, mail, gravatar_url] email a string or an object used
to generate the gravatar url from
@param [Symbol, Hash] *params other gravatar or html options for building the resulting
image tag.
@return [String] a complete and hopefully valid img tag.