Class: Interceptors::TransactionInterceptor

Inherits:
Interceptor
  • Object
show all
Defined in:
lib/interceptors/transaction_interceptor.rb

Instance Method Summary collapse

Methods inherited from Interceptor

#after, #before

Constructor Details

#initialize(adapter: default_adapter) ⇒ TransactionInterceptor

Returns a new instance of TransactionInterceptor.



5
6
7
# File 'lib/interceptors/transaction_interceptor.rb', line 5

def initialize(adapter: default_adapter)
  @adapter = adapter
end

Instance Method Details

#around(ctx) ⇒ Object



9
10
11
12
13
# File 'lib/interceptors/transaction_interceptor.rb', line 9

def around(ctx)
  return yield ctx unless @adapter

  @adapter.call { yield ctx }
end