Class: Wakame::ActorRegistry
- Inherits:
-
Object
- Object
- Wakame::ActorRegistry
- Defined in:
- lib/wakame/agent.rb
Instance Attribute Summary collapse
-
#actors ⇒ Object
readonly
Returns the value of attribute actors.
Instance Method Summary collapse
- #find_actor(path) ⇒ Object
-
#initialize ⇒ ActorRegistry
constructor
A new instance of ActorRegistry.
- #register(actor, path = nil) ⇒ Object
- #unregister(path) ⇒ Object
Constructor Details
#initialize ⇒ ActorRegistry
Returns a new instance of ActorRegistry.
119 120 121 |
# File 'lib/wakame/agent.rb', line 119 def initialize() @actors = {} end |
Instance Attribute Details
#actors ⇒ Object (readonly)
Returns the value of attribute actors.
118 119 120 |
# File 'lib/wakame/agent.rb', line 118 def actors @actors end |
Instance Method Details
#find_actor(path) ⇒ Object
142 143 144 |
# File 'lib/wakame/agent.rb', line 142 def find_actor(path) @actors[path] end |
#register(actor, path = nil) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/wakame/agent.rb', line 123 def register(actor, path=nil) raise '' unless actor.kind_of?(Wakame::Actor) if path.nil? path = '/' + Util.to_const_path(actor.class.to_s) end if @actors.has_key?(path) Wakame.log.error("#{self.class}: Duplicate registration: #{path}") raise "Duplicate registration: #{path}" end @actors[path] = actor end |
#unregister(path) ⇒ Object
138 139 140 |
# File 'lib/wakame/agent.rb', line 138 def unregister(path) @actors.delete(path) end |