Class: Recruiter::UserDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/decorators/recruiter/user_decorator.rb

Instance Method Summary collapse

Instance Method Details

#avatar(width = 50, height = 50) ⇒ Object



5
6
7
8
9
# File 'app/decorators/recruiter/user_decorator.rb', line 5

def avatar(width = 50, height = 50)
  url ||= image_url
  url ||= gravatar_url
  h.image_tag(url, width: width, height: height)
end

#gravatar_urlObject



15
16
17
18
19
20
# File 'app/decorators/recruiter/user_decorator.rb', line 15

def gravatar_url
  if email
    hash = Digest::MD5.hexdigest(email)
    "http://www.gravatar.com/avatar/#{hash}"
  end
end

#image_urlObject



11
12
13
# File 'app/decorators/recruiter/user_decorator.rb', line 11

def image_url
  @image_url ||= object.provider_data.deep_symbolize_keys[:info][:image]
end