Module: Dry::Transaction::Extra::PerformLater
- Includes:
- Monads::Result::Mixin
- Defined in:
- lib/dry/transaction/extra/perform_later.rb
Defined Under Namespace
Classes: ConfiguredJob
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(klass) ⇒ Object
7 8 9 10 11 |
# File 'lib/dry/transaction/extra/perform_later.rb', line 7 def self.extended(klass) klass.extend Dry::Core::ClassAttributes klass.defines :transaction_job end |
Instance Method Details
#perform_later(*args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dry/transaction/extra/perform_later.rb', line 19 def perform_later(*args) if validator result = validator.new.call(*args).to_monad return result unless result.success? args = [result.value!.to_h] end Dry::Monads::Success(transaction_job.new(transaction_class_name: name, args:).enqueue) end |
#set(options = {}) ⇒ Object
15 16 17 |
# File 'lib/dry/transaction/extra/perform_later.rb', line 15 def set( = {}) ConfiguredJob.new(transaction_job, self, ) end |