Class: Synapse::UnitOfWork::UnitOfWorkFactory
- Inherits:
-
Object
- Object
- Synapse::UnitOfWork::UnitOfWorkFactory
- Defined in:
- lib/synapse/uow/factory.rb
Overview
Factory that creates and configures new unit of work instances
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create ⇒ UnitOfWork
Creates and starts a unit of work.
- #initialize(provider) ⇒ undefined constructor
Constructor Details
#initialize(provider) ⇒ undefined
10 11 12 |
# File 'lib/synapse/uow/factory.rb', line 10 def initialize(provider) @provider = provider end |
Instance Attribute Details
#transaction_manager ⇒ TransactionManager
6 7 8 |
# File 'lib/synapse/uow/factory.rb', line 6 def transaction_manager @transaction_manager end |
Instance Method Details
#create ⇒ UnitOfWork
Creates and starts a unit of work
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/synapse/uow/factory.rb', line 16 def create unit = UnitOfWork.new @provider unit.tap do if @transaction_manager unit.transaction_manager = @transaction_manager end unit.start end end |