Module: Rlyeh::Worker

Included in:
Connection
Defined in:
lib/rlyeh/worker.rb

Defined Under Namespace

Modules: ClassMethods Classes: ThreadPool

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
# File 'lib/rlyeh/worker.rb', line 14

def included(base)
  base.extend ClassMethods
end

.setup(options = {}) ⇒ Object



18
19
20
# File 'lib/rlyeh/worker.rb', line 18

def setup(options = {})
  @worker_pool = ThreadPool.pool options
end

.worker_poolObject



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

def worker_pool
  @worker_pool ||= setup
end

Instance Method Details

#invoke(*args, &block) ⇒ Object



33
34
35
# File 'lib/rlyeh/worker.rb', line 33

def invoke(*args, &block)
  self.class.worker_pool.invoke *args, &block
end