Module: DataMapper::Transaction::Adapter
- Extended by:
- Chainable
- Defined in:
- lib/dm-core/transaction.rb
Class Method Summary collapse
-
.included(base) ⇒ Object
private
TODO: document.
Instance Method Summary collapse
-
#current_transaction ⇒ Transaction
private
Retrieve the current transaction for this Adapter.
-
#pop_transaction ⇒ Transaction
private
Pop the ‘current’ Transaction from the per thread Transaction stack so that everything done by this Adapter is no longer necessarily within the context of said Transaction.
-
#push_transaction(transaction) ⇒ Array(Transaction)
private
Pushes the given Transaction onto the per thread Transaction stack so that everything done by this Adapter is done within the context of said Transaction.
-
#transaction_primitive ⇒ Object
private
Produces a fresh transaction primitive for this Adapter.
Methods included from Chainable
Class Method Details
.included(base) ⇒ 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.
TODO: document
343 344 345 346 347 |
# File 'lib/dm-core/transaction.rb', line 343 def self.included(base) [ :Repository, :Model, :Resource ].each do |name| DataMapper.const_get(name).send(:include, Transaction.const_get(name)) end end |
Instance Method Details
#current_transaction ⇒ 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.
Retrieve the current transaction for this Adapter.
Everything done by this Adapter is done within the context of this Transaction.
398 399 400 |
# File 'lib/dm-core/transaction.rb', line 398 def current_transaction transactions.last end |
#pop_transaction ⇒ 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.
Pop the ‘current’ Transaction from the per thread Transaction stack so that everything done by this Adapter is no longer necessarily within the context of said Transaction.
385 386 387 |
# File 'lib/dm-core/transaction.rb', line 385 def pop_transaction transactions.pop end |
#push_transaction(transaction) ⇒ Array(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.
Pushes the given Transaction onto the per thread Transaction stack so that everything done by this Adapter is done within the context of said Transaction.
373 374 375 |
# File 'lib/dm-core/transaction.rb', line 373 def push_transaction(transaction) transactions << transaction end |
#transaction_primitive ⇒ 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.
Produces a fresh transaction primitive for this Adapter
Used by Transaction to perform its various tasks.
358 359 360 |
# File 'lib/dm-core/transaction.rb', line 358 def transaction_primitive DataObjects::Transaction.create_for_uri(normalized_uri) end |