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.
144 145 146 |
# File 'lib/wakame/agent.rb', line 144 def initialize() @actors = {} end |
Instance Attribute Details
#actors ⇒ Object (readonly)
Returns the value of attribute actors.
143 144 145 |
# File 'lib/wakame/agent.rb', line 143 def actors @actors end |
Instance Method Details
#find_actor(path) ⇒ Object
167 168 169 |
# File 'lib/wakame/agent.rb', line 167 def find_actor(path) @actors[path] end |
#register(actor, path = nil) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/wakame/agent.rb', line 148 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
163 164 165 |
# File 'lib/wakame/agent.rb', line 163 def unregister(path) @actors.delete(path) end |