Sha256: 6bf1ef5aa9557ad4f0d9a6386c2e4ac4ffb2c68864122c4113737cf8971fb05b

Contents?: true

Size: 348 Bytes

Versions: 5

Compression:

Stored size: 348 Bytes

Contents

module NxtPipeline
  class ErrorCallback
    def initialize(errors, callback)
      @errors = errors
      @callback = callback
    end

    attr_accessor :errors, :callback

    def applies_to_error?(error)
      (error.class.ancestors & errors).any?
    end

    def call(step, arg, error)
      callback.call(step, arg, error)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nxt_pipeline-0.2.5 lib/nxt_pipeline/error_callback.rb
nxt_pipeline-0.2.4 lib/nxt_pipeline/error_callback.rb
nxt_pipeline-0.2.3 lib/nxt_pipeline/error_callback.rb
nxt_pipeline-0.2.2 lib/nxt_pipeline/error_callback.rb
nxt_pipeline-0.2.1 lib/nxt_pipeline/error_callback.rb