def poll(wait = 8, delay = 0.1)
      try_until = Time.now + wait

      while Time.now < try_until do
        result = yield
        return result if result
        sleep delay
      end
      raise TimeoutError
    end
def poll(wait = 8, delay = 0.1)
      try_until = Time.now + wait

      while Time.now < try_until do
        result = yield
        return result if result
        sleep delay
      end
      raise TimeoutError
    end
`#poll` is a method for knowing when something is ready. When your
 block yields true, execution continues. When your block yields false,
 poll keeps trying until it gives up and raises an error.

 @example wait up to 30 seconds for the TCP socket to respond.
   def wait_for_server
     poll(30) do
       begin
         TCPSocket.new(SERVER_IP, SERVER_PORT)
         true
       rescue Exception
         false
       end
     end
   end

 @param [Integer] wait
   The number of seconds seconds to poll.

 @param [Integer] delay
   Number of seconds to wait after encountering a failure, default is
   0.1 seconds

 @yield [Proc]
   A block that determines whether polling should continue. Return
   `true` if the polling is complete. Return `false` if polling should
   continue.

 @raise [Hoodie::PollingError]
   Raised after too many failed attempts.

 @return [Proc]
   The value of the passed block.

 @api public