lib/turntabler/client.rb
def wait(&block)
      fiber = Fiber.current

      # Resume the fiber when a response is received
      allow_resume = true
      block.call do |*args|
        fiber.resume(*args) if allow_resume
      end

      # Attempt to pause the fiber until a response is received
      begin
        Fiber.yield
      rescue FiberError => ex
        allow_resume = false
        raise Error, 'Turntabler APIs cannot be called from root fiber; use Turntabler.run { ... } instead'
      end
    end
def wait(&block)
      fiber = Fiber.current

      # Resume the fiber when a response is received
      allow_resume = true
      block.call do |*args|
        fiber.resume(*args) if allow_resume
      end

      # Attempt to pause the fiber until a response is received
      begin
        Fiber.yield
      rescue FiberError => ex
        allow_resume = false
        raise Error, 'Turntabler APIs cannot be called from root fiber; use Turntabler.run { ... } instead'
      end
    end
Pauses the current fiber until it is resumed with response data.  This
 can only get resumed explicitly by the provided block.