Module: Gravtastic::InstanceMethods

Defined in:
lib/gravtastic.rb

Instance Method Summary collapse

Instance Method Details

#gravatar_idObject

The raw MD5 hash of the users' email. Gravatar is particularly tricky as it downcases all emails. This is really the guts of the module, everything else is just convenience.



77
78
79
# File 'lib/gravtastic.rb', line 77

def gravatar_id
  Digest::MD5.hexdigest(send(self.class.gravatar_source).to_s.downcase)
end

#gravatar_url(options = {}) ⇒ Object

Constructs the full Gravatar url.



82
83
84
85
86
87
# File 'lib/gravtastic.rb', line 82

def gravatar_url(options={})
  options = self.class.gravatar_defaults.merge(options)
  gravatar_hostname(options.delete(:secure)) +
    gravatar_filename(options.delete(:filetype)) +
    url_params_from_hash(options)
end