Class: Guard::Jobs::Sleep

Inherits:
Base
  • Object
show all
Defined in:
lib/guard/jobs/sleep.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Guard::Jobs::Base

Instance Method Details

#backgroundObject



17
18
19
# File 'lib/guard/jobs/sleep.rb', line 17

def background
  Thread.main.wakeup
end

#foregroundObject



7
8
9
10
11
12
13
14
15
# File 'lib/guard/jobs/sleep.rb', line 7

def foreground
  UI.debug "Guards jobs done. Sleeping..."
  sleep
  UI.debug "Sleep interrupted by events."
  :stopped
rescue Interrupt
  UI.debug "Sleep interrupted by user."
  :exit
end

#handle_interruptObject



21
22
23
# File 'lib/guard/jobs/sleep.rb', line 21

def handle_interrupt
  Thread.main.raise Interrupt
end