Class: Apophis::DottyTimeout

Inherits:
Object
  • Object
show all
Defined in:
lib/apophis/dotty_timeout.rb

Class Method Summary collapse

Class Method Details

.timeout(timeout, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/apophis/dotty_timeout.rb', line 4

def self.timeout(timeout, &block)
  Timeout.timeout(timeout) do
    while(true)
      break if block.call
      sleep(2)
      putc '.'
    end
  end
  puts
end