Class: Stooge::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/stooge/worker.rb

Class Method Summary collapse

Class Method Details

.run!Object

Start the Stooge worker that processes jobs.



7
8
9
10
11
12
13
14
# File 'lib/stooge/worker.rb', line 7

def self.run!
  Stooge.log "Starting stooge"

  Signal.trap('INT') { Stooge.stop! }
  Signal.trap('TERM'){ Stooge.stop! }

  Stooge.start!
end

.run?Boolean

Should the Stooge worker be started?

Returns:

  • (Boolean)

    true or false



21
22
23
24
# File 'lib/stooge/worker.rb', line 21

def self.run?
  Stooge.has_handlers? &&
    File.expand_path($0) == File.expand_path(app_file)
end