Class: Smith::Workflow::SplitStepPersistence::TransactionIdentity
- Inherits:
-
Object
- Object
- Smith::Workflow::SplitStepPersistence::TransactionIdentity
- Extended by:
- Dry::Initializer
- Defined in:
- lib/smith/workflow/split_step_persistence/transaction_identity.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.capture(adapter) ⇒ Object
13 |
# File 'lib/smith/workflow/split_step_persistence/transaction_identity.rb', line 13 def self.capture(adapter) = new(adapter).capture |
.matches?(adapter, expected) ⇒ Boolean
14 |
# File 'lib/smith/workflow/split_step_persistence/transaction_identity.rb', line 14 def self.matches?(adapter, expected) = new(adapter).matches?(expected) |
Instance Method Details
#capture ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/smith/workflow/split_step_persistence/transaction_identity.rb', line 16 def capture return unless PersistenceAdapters.supports?(adapter, :transaction_open?) return unless adapter.transaction_open? ensure_identity_capability! identity = adapter.transaction_identity if !identity || identity.to_s.empty? raise WorkflowError, "transactional split-step persistence requires an active transaction identity" end identity.to_s.dup.freeze end |
#matches?(expected) ⇒ Boolean
29 30 31 32 33 |
# File 'lib/smith/workflow/split_step_persistence/transaction_identity.rb', line 29 def matches?(expected) capture == expected rescue StandardError false end |