Sha256: 7e25b27c709bf3ec4e5f636fd45c35355e07506a4ae27bb2f5a1dc05b23b5c65
Contents?: true
Size: 617 Bytes
Versions: 1
Compression:
Stored size: 617 Bytes
Contents
module DirtyPipeline class Transition def Abort() throw :abort, true end def Error(error) throw :fail_with_error, error end def Success(output = nil, after_commit: nil, &block) result = [output.to_h] after_commit = Array(after_commit) << block if block_given? result += Array(after_commit) if after_commit throw :success, result end def self.call(*args, **kwargs) subject = args.shift instance = new(*args, **kwargs) instance.compensate(subject) if instance.respond_to?(:compensate) instance.call(subject) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dirty_pipeline-0.2.0 | lib/dirty_pipeline/transition.rb |