Class: ROM::SQL::Transaction Private

Inherits:
Transaction
  • Object
show all
Defined in:
lib/rom/sql/transaction.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Transaction

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Transaction.



8
9
10
# File 'lib/rom/sql/transaction.rb', line 8

def initialize(connection)
  @connection = connection
end

Instance Method Details

#run(opts = EMPTY_HASH) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
15
16
# File 'lib/rom/sql/transaction.rb', line 12

def run(opts = EMPTY_HASH)
  connection.transaction(opts) { yield(self) }
rescue ::ROM::Transaction::Rollback
  # noop
end