Class: Rays::Worker::Manager

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rays/workers/base.rb

Instance Method Summary collapse

Constructor Details

#initializeManager

Returns a new instance of Manager.



28
29
30
# File 'lib/rays/workers/base.rb', line 28

def initialize
  @workers = {}
end

Instance Method Details

#create(type, name) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/rays/workers/base.rb', line 37

def create(type, name)
  if !@workers[type].nil? and !@workers[type][name].nil?
    @workers[type][name].instance
  else
    raise RaysException.new("Cannot find #{type} #{name}")
  end
end

#register(type, name, worker_class) ⇒ Object



32
33
34
35
# File 'lib/rays/workers/base.rb', line 32

def register(type, name, worker_class)
  @workers[type] = {} if @workers[type].nil?
  @workers[type][name] = worker_class
end