Module: Runify

Defined in:
lib/runify.rb,
lib/runify/version.rb

Overview

Runify Module

Constant Summary collapse

VERSION =

Version

'1.0.1'

Instance Method Summary collapse

Instance Method Details

#restartObject

Restart: Calls shutdown, immediately followed by startup.



32
33
34
35
# File 'lib/runify.rb', line 32

def restart
  shutdown
  startup
end

#shutdownObject

Shutdown: Requests the run method to complete and blocks until it returns.



24
25
26
27
28
# File 'lib/runify.rb', line 24

def shutdown
  @stop = true
  @thread.join if defined?(@thread) && @thread
  @thread = nil
end

#startupObject

Startup: Spawns a new Thread around the run method.



16
17
18
19
20
# File 'lib/runify.rb', line 16

def startup
  return if defined?(@thread) && @thread
  @stop = nil
  @thread = Thread.new { run }
end