Class: Producers::ShowProducer

Inherits:
BaseUseCase
  • Object
show all
Defined in:
lib/winewoo_core/use_cases/producers/show_producer.rb

Instance Method Summary collapse

Constructor Details

#initialize(log_params = nil) ⇒ ShowProducer

Returns a new instance of ShowProducer.



4
5
6
# File 'lib/winewoo_core/use_cases/producers/show_producer.rb', line 4

def initialize(log_params=nil)
  super(WinewooCore.producers_repo.new, log_params)
end

Instance Method Details

#call(producer_id) {|producer ? UseCaseResults.found(producer) : UseCaseResults.not_found| ... } ⇒ Object

Yields:



9
10
11
12
13
14
15
# File 'lib/winewoo_core/use_cases/producers/show_producer.rb', line 9

def call(producer_id)
  producer = self.repo.get(producer_id)

  yield producer ?
    UseCaseResults.found(producer) :
    UseCaseResults.not_found
end