lib/resilient/circuit_breaker.rb
def allow_request?
      instrument("resilient.circuit_breaker.allow_request", key: @key) { |payload|
        payload[:result] = if payload[:force_open] = @properties.force_open
          false
        else
          # we still want to simulate normal behavior/metrics like open, allow
          # single request, etc. so it is possible to test properties in
          # production without impact using force_closed so we run these here
          # instead of in the else below
          allow_request = !open? || allow_single_request?

          if payload[:force_closed] = @properties.force_closed
            true
          else
            allow_request
          end
        end
      }
    end
def allow_request?
      instrument("resilient.circuit_breaker.allow_request", key: @key) { |payload|
        payload[:result] = if payload[:force_open] = @properties.force_open
          false
        else
          # we still want to simulate normal behavior/metrics like open, allow
          # single request, etc. so it is possible to test properties in
          # production without impact using force_closed so we run these here
          # instead of in the else below
          allow_request = !open? || allow_single_request?

          if payload[:force_closed] = @properties.force_closed
            true
          else
            allow_request
          end
        end
      }
    end
Private: Builds new instance of a CircuitBreaker.

  key - The String or Resilient::Key that determines uniqueness of the
        circuit breaker in the registry and for instrumentation.

  properties - The Hash or Resilient::CircuitBreaker::Properties that determine how the
               circuit breaker should behave. Optional. Defaults to new
               Resilient::CircuitBreaker::Properties instance.

 Returns CircuitBreaker instance.