Class: AvatarPresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/avatar_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

#current_user

Instance Method Summary collapse

Methods inherited from BasePresenter

as_collection, #initialize, #method_missing, new

Constructor Details

This class inherits a constructor from BasePresenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BasePresenter

Instance Method Details

#base_hash(with_default = false) ⇒ Object


5
6
7
8
9
10
11
12
13
14
# File 'app/presenters/avatar_presenter.rb', line 5

def base_hash(with_default=false)
  avatar = {
    small:  small(with_default),
    medium: medium(with_default),
    large:  large(with_default),
    raw:    raw(with_default) # rubocop:disable Rails/OutputSafety
  }.compact

  avatar unless avatar.empty?
end

#large(with_default = false) ⇒ Object


24
25
26
# File 'app/presenters/avatar_presenter.rb', line 24

def large(with_default=false)
  image_url(size: :scaled_full, fallback_to_default: with_default)
end

#medium(with_default = false) ⇒ Object


20
21
22
# File 'app/presenters/avatar_presenter.rb', line 20

def medium(with_default=false)
  image_url(size: :thumb_medium, fallback_to_default: with_default)
end

#raw(with_default = false) ⇒ Object


28
29
30
31
# File 'app/presenters/avatar_presenter.rb', line 28

def raw(with_default=false)
  # TODO: Replace me with the actual raw photo.
  image_url(fallback_to_default: with_default)
end

#small(with_default = false) ⇒ Object


16
17
18
# File 'app/presenters/avatar_presenter.rb', line 16

def small(with_default=false)
  image_url(size: :thumb_small, fallback_to_default: with_default)
end