Class: Labor::Worker

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/labor/worker.rb

Instance Method Summary collapse

Methods included from Helpers

#classify, #constantize, #log

Constructor Details

#initialize(*abilities) ⇒ Worker

Returns a new instance of Worker.



5
6
7
8
# File 'lib/labor/worker.rb', line 5

def initialize(*abilities)
  @worker = Gearman::Worker.new
  add_abilities(abilities)
end

Instance Method Details

#workObject

Starts the work loop.

Returns nothing.



13
14
15
16
17
# File 'lib/labor/worker.rb', line 13

def work
  @worker.job_servers = Labor.servers
  register_signals
  loop { @worker.work or break }
end