Class: Theatre::ActorNamespaceManager::NamespaceNode
- Defined in:
- lib/theatre/namespace_manager.rb
Overview
Used by NamespaceManager to build a tree of namespaces. Has a Hash of children which is not Thread-safe. For Thread-safety, all access should semaphore through the NamespaceManager.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #callbacks ⇒ Object
- #child_named(name) ⇒ Object
- #delete_callback(callback) ⇒ Object
- #destroy_namespace(name) ⇒ Object
-
#initialize(name) ⇒ NamespaceNode
constructor
A new instance of NamespaceNode.
- #register_callback(callback) ⇒ Object
- #register_namespace_name(name) ⇒ Object
- #root? ⇒ Boolean
Constructor Details
#initialize(name) ⇒ NamespaceNode
Returns a new instance of NamespaceNode.
99 100 101 102 103 |
# File 'lib/theatre/namespace_manager.rb', line 99 def initialize(name) @name = name.freeze @children = {} @callbacks = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
98 99 100 |
# File 'lib/theatre/namespace_manager.rb', line 98 def name @name end |
Instance Method Details
#callbacks ⇒ Object
114 115 116 |
# File 'lib/theatre/namespace_manager.rb', line 114 def callbacks @callbacks.clone end |
#child_named(name) ⇒ Object
122 123 124 |
# File 'lib/theatre/namespace_manager.rb', line 122 def child_named(name) @children[name] end |
#delete_callback(callback) ⇒ Object
118 119 120 |
# File 'lib/theatre/namespace_manager.rb', line 118 def delete_callback(callback) @callbacks.delete callback end |
#destroy_namespace(name) ⇒ Object
126 127 128 |
# File 'lib/theatre/namespace_manager.rb', line 126 def destroy_namespace(name) @children.delete name end |
#register_callback(callback) ⇒ Object
109 110 111 112 |
# File 'lib/theatre/namespace_manager.rb', line 109 def register_callback(callback) @callbacks << callback callback end |
#register_namespace_name(name) ⇒ Object
105 106 107 |
# File 'lib/theatre/namespace_manager.rb', line 105 def register_namespace_name(name) @children[name] ||= NamespaceNode.new(name) end |
#root? ⇒ Boolean
130 131 132 |
# File 'lib/theatre/namespace_manager.rb', line 130 def root? false end |