Module: Gravtastic

Defined in:
lib/gravtastic.rb,
lib/gravtastic/engine.rb,
lib/gravtastic/version.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, StageOne Classes: Engine

Constant Summary collapse

VERSION =
'3.2.6'

Class Method Summary collapse

Class Method Details

.configure(model, *args, &blk) ⇒ Object

Sets the model's default attributes. It is called when you use #gravtastic in your model.



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gravtastic.rb', line 25

def self.configure(model, *args, &blk)
  options = args.last.is_a?(Hash) ? args.pop : {}

  model.gravatar_defaults = {
    :rating =>   'PG',
    :secure =>   true,
    :filetype => :png
  }.merge(options)

  # The method where Gravtastic get the users' email from defaults to `#email`.
  model.gravatar_source = args.first || :email
end

.included(model) ⇒ Object

When you include Gravtastic, Ruby automatically calls this method with the class you called it in. It allows us extend the class with the #gravtastic method.



19
20
21
# File 'lib/gravtastic.rb', line 19

def self.included(model)
  model.extend StageOne
end

.versionObject

Returns the version of Gravtastic



6
7
8
# File 'lib/gravtastic/version.rb', line 6

def self.version
  VERSION
end