Sha256: c31345f4d0ada5eb9657a8a3dd7970cbceecda93397562a480334e04924e3303
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
module DirtyPipeline class Status < SimpleDelegator attr_accessor :error, :succeeded, :action_pool attr_reader :storage, :pipeline def initialize(*) super @storage = __getobj__.storage @action_pool = [] end def wrap return self if succeeded == false self.succeeded = nil yield self end def success? succeeded end def when_success(callback = nil) return self unless success? if block_given? yield(self) else callback.call(self) end self end def when_failed(callback = nil) return self unless storage.failed? if block_given? yield(self) else callback.call(self) end self end def errored? return if succeeded.nil? ready? && !succeeded end def when_error(callback = nil) return self unless errored? if block_given? yield(self) else callback.call(self) end self end def ready? storage.pipeline_status.nil? end def when_processing(callback = nil) return self unless storage.processing? if block_given? yield(self) else callback.call(self) end self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dirty_pipeline-0.3.0 | lib/dirty_pipeline/status.rb |