class AllMyCircuits::NullBreaker

Public: no-op circuit breaker implementation, useful for testing

Attributes

closed[RW]
name[R]

Public Class Methods

new(name:, closed:) click to toggle source
# File lib/all_my_circuits/null_breaker.rb, line 9
def initialize(name:, closed:)
  @name = name
  @closed = closed
end

Public Instance Methods

run() { || ... } click to toggle source
# File lib/all_my_circuits/null_breaker.rb, line 14
def run
  if @closed
    yield
  else
    raise AllMyCircuits::BreakerOpen, @name
  end
end