Class: Wines::ListWines
- Inherits:
-
BaseUseCase
- Object
- BaseUseCase
- Wines::ListWines
- Defined in:
- lib/winewoo_core/use_cases/wines/list_wines.rb
Instance Method Summary collapse
- #call(filters) {|wines ? UseCaseResults.found(wines, total) : UseCaseResults.failure| ... } ⇒ Object
-
#initialize(current_user, log_params = nil) ⇒ ListWines
constructor
A new instance of ListWines.
Constructor Details
#initialize(current_user, log_params = nil) ⇒ ListWines
Returns a new instance of ListWines.
4 5 6 7 |
# File 'lib/winewoo_core/use_cases/wines/list_wines.rb', line 4 def initialize(current_user, log_params=nil) super(WinewooCore.wines_repo.new, log_params) self.current_caller = current_user end |
Instance Method Details
#call(filters) {|wines ? UseCaseResults.found(wines, total) : UseCaseResults.failure| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/winewoo_core/use_cases/wines/list_wines.rb', line 10 def call(filters) return unless (&Proc.new) wines, action, total = self.repo.find(filters) log_search(action, filters.query, total) yield wines ? UseCaseResults.found(wines, total) : UseCaseResults.failure end |