module InterruptibleSleep

Public Instance Methods

interrupt_sleep() click to toggle source
# File lib/interruptible_sleep.rb, line 9
def interrupt_sleep
  @_sleep_interrupt.close if @_sleep_interrupt && !@_sleep_interrupt.closed?
end
interruptible_sleep(seconds) click to toggle source
# File lib/interruptible_sleep.rb, line 2
def interruptible_sleep(seconds)
  if seconds > 0
    @_sleep_check, @_sleep_interrupt = IO.pipe
    IO.select([@_sleep_check], nil, nil, seconds)
  end
end