Module: MyGravatar::GravatarExtensions

Defined in:
lib/my_gravatar/gravatar_extensions.rb

Class Method Summary collapse

Class Method Details

.account_key(value) ⇒ Object



9
10
11
12
13
# File 'lib/my_gravatar/gravatar_extensions.rb', line 9

def (value)
  require 'digest/md5'

  digest = Digest::MD5.hexdigest(value.lstrip.rstrip.downcase)
end

.gravatar_default_value(key) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/my_gravatar/gravatar_extensions.rb', line 26

def gravatar_default_value(key)
  case (key)
    when "size"
      size
    when "default_image"
      image
    when "rating"
      rating
  end      
end

.gravatar_param_key(key) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/my_gravatar/gravatar_extensions.rb', line 15

def gravatar_param_key(key)
  case (key)
    when "size"
      "s"
    when "default_image"
      "d"
    when "rating"
      "r"
  end    
end

.imageObject



41
42
43
# File 'lib/my_gravatar/gravatar_extensions.rb', line 41

def image
  "retro"
end

.ratingObject



45
46
47
# File 'lib/my_gravatar/gravatar_extensions.rb', line 45

def rating
  "g"
end

.sizeObject



37
38
39
# File 'lib/my_gravatar/gravatar_extensions.rb', line 37

def size
  "200"
end

.url(https) ⇒ Object



5
6
7
# File 'lib/my_gravatar/gravatar_extensions.rb', line 5

def url(https)
  https ? "https://secure.gravatar.com/avatar" : "http://www.gravatar.com/avatar"
end