Sha256: 154b5d90e93a72535ae8695b6aea61cb44a6d0100fa2f1ba37c1e748696babb4

Contents?: true

Size: 319 Bytes

Versions: 4

Compression:

Stored size: 319 Bytes

Contents

module Dialers
  class ShortCircuit
    def initialize(condition, action)
      self.condition = condition
      self.action = action
    end

    def can_stop?(response)
      condition.call(response)
    end

    def stop(response)
      action.call(response)
    end

    attr_accessor :condition, :action
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dialers-0.2.2 lib/dialers/short_circuit.rb
dialers-0.1.2 lib/dialers/short_circuit.rb
dialers-0.1.1 lib/dialers/short_circuit.rb
dialers-0.1.0 lib/dialers/short_circuit.rb