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.
122 123 124 |
# File 'lib/wakame/agent.rb', line 122 def initialize() @actors = {} end |
Instance Attribute Details
#actors ⇒ Object (readonly)
Returns the value of attribute actors.
121 122 123 |
# File 'lib/wakame/agent.rb', line 121 def actors @actors end |
Instance Method Details
#find_actor(path) ⇒ Object
145 146 147 |
# File 'lib/wakame/agent.rb', line 145 def find_actor(path) @actors[path] end |
#register(actor, path = nil) ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/wakame/agent.rb', line 126 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
141 142 143 |
# File 'lib/wakame/agent.rb', line 141 def unregister(path) @actors.delete(path) end |