The Registry allows us to refer to specific actors by human-meaningful names
Retrieve an actor by name
# File lib/celluloid/registry.rb, line 26 def [](name) @registry_lock.synchronize do @registry[name.to_sym] end end
Register an Actor
# File lib/celluloid/registry.rb, line 12 def []=(name, actor) actor_singleton = class << actor; self; end unless actor_singleton.ancestors.include? AbstractProxy raise TypeError, "not an actor" end @registry_lock.synchronize do @registry[name.to_sym] = actor end actor.mailbox << NamingRequest.new(name.to_sym) end
removes and returns all registered actors as a hash of `name => actor` can be used in testing to clear the registry
# File lib/celluloid/registry.rb, line 48 def clear hash = nil @registry_lock.synchronize do hash = @registry.dup @registry.clear end hash end
# File lib/celluloid/registry.rb, line 35 def delete(name) @registry_lock.synchronize do @registry.delete name.to_sym end end
Generated with the Darkfish Rdoc Generator 2.