Sha256: 3db276425c8a41d2dc30e5705360428c1ec5ce70edcd8043ae6932683dbdabba

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

module Sufia
  class UserProfilePresenter
    def initialize(user, ability)
      @user = user
      @ability = ability
    end

    attr_reader :user, :ability

    delegate :name, to: :user

    # @return true if the presenter is for the logged in user
    def current_user?
      user == ability.current_user
    end

    def events
      @events ||= if user.respond_to? :profile_events
                    user.profile_events(100)
                  else
                    []
                  end
    end

    def trophies
      @trophies ||= user.trophy_works
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sufia-7.0.0.beta4 app/presenters/sufia/user_profile_presenter.rb