Sha256: e67513c1cf25f9b5834058c943da744e83c712aefb818f15f4dfd5baeafc9b99

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

require 'explicit_delegator'

class ProfilePresenter < ExplicitDelegator
  DEFAULT_IMAGE        = 'woople-theme/missing-profile.png'
  MISSING_WOOPLE_IMAGE = '/assets/retina_thumb/missing.png'

  enforce_definitions :image, :sections

  def image
    normalized(profile.image)
  end

  def sections
    @sections ||= ThemePresentation.wrap_collection(profile.sections, ProfileSectionPresenter)
  end

  private

  def profile
    __getobj__
  end

  def normalized(image)
    if image.nil? || image == MISSING_WOOPLE_IMAGE
      DEFAULT_IMAGE
    else
      image
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
woople-theme-0.6.11 app/presenters/profile_presenter.rb
woople-theme-0.6.10 app/presenters/profile_presenter.rb