asciinema.org/app/presenters/user_edit_page_presenter.rb
2015-04-03 17:07:38 +00:00

28 lines
394 B
Ruby

class UserEditPagePresenter
attr_reader :user
def initialize(user)
@user = user
end
def active_tokens
sort(user.active_api_tokens)
end
def revoked_tokens
sort(user.revoked_api_tokens)
end
def show_tokens?
!active_tokens.empty? || !revoked_tokens.empty?
end
private
def sort(tokens)
tokens.sort_by { |token| token.created_at }.reverse
end
end