Sha256: f30eea71cabaac853004baecbc38f4bb2473dfe33e6456be777030620120e3ce
Contents?: true
Size: 465 Bytes
Versions: 3
Compression:
Stored size: 465 Bytes
Contents
# frozen_string_literal: true module Spandx module Core class Circuit attr_reader :state def initialize(state: :closed) @state = state end def attempt return if open? open! result = yield close! result end def open! @state = :open end def close! @state = :closed end def open? state == :open end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spandx-0.12.2 | lib/spandx/core/circuit.rb |
spandx-0.12.1 | lib/spandx/core/circuit.rb |
spandx-0.12.0 | lib/spandx/core/circuit.rb |