Class: Users::ListUsers

Inherits:
BaseUseCase
  • Object
show all
Defined in:
lib/winewoo_core/use_cases/users/list_users.rb

Instance Method Summary collapse

Constructor Details

#initialize(current_user) ⇒ ListUsers

Returns a new instance of ListUsers.



4
5
6
7
# File 'lib/winewoo_core/use_cases/users/list_users.rb', line 4

def initialize(current_user)
  super(WinewooCore.users_repo.new)
  self.current_caller = current_user
end

Instance Method Details

#call(filters) {|users ? UseCaseResults.found(users, total) : UseCaseResults.failure| ... } ⇒ Object

Yields:



10
11
12
13
14
15
16
17
18
# File 'lib/winewoo_core/use_cases/users/list_users.rb', line 10

def call(filters)
  return unless authorize_users_index(&Proc.new)

  users, total = self.repo.find(filters)

  yield users ?
    UseCaseResults.found(users, total) :
    UseCaseResults.failure
end