Module: UseCases::ModuleOptins::Transactional::DoCallPatch

Defined in:
lib/use_cases/module_optins/transactional.rb

Instance Method Summary collapse

Instance Method Details

#do_callObject



16
17
18
19
20
21
22
23
24
# File 'lib/use_cases/module_optins/transactional.rb', line 16

def do_call(*)
  unless respond_to?(:transaction_handler)
    raise TransactionHandlerUndefined, "when using *transactional*, make sure to include a transaction handler in your dependencies."
  end

  raise TransactionHandlerInvalid, "Make sure your transaction_handler implements #transaction." unless transaction_handler.respond_to?(:transaction)

  transaction_handler.transaction { super }
end