Class: ActiveRecord::ConnectionAdapters::Transaction::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/transaction.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(event, callback) ⇒ Callback

Returns a new instance of Callback.



130
131
132
133
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 130

def initialize(event, callback)
  @event = event
  @callback = callback
end

Instance Method Details

#after_commitObject



139
140
141
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 139

def after_commit
  @callback.call if @event == :after_commit
end

#after_rollbackObject



143
144
145
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 143

def after_rollback
  @callback.call if @event == :after_rollback
end

#before_commitObject



135
136
137
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 135

def before_commit
  @callback.call if @event == :before_commit
end