Class: Theatre::ActorNamespaceManager::NamespaceNode

Inherits:
Object
  • Object
show all
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

RootNamespaceNode

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (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

#callbacksObject



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

Returns:

  • (Boolean)


130
131
132
# File 'lib/theatre/namespace_manager.rb', line 130

def root?
  false
end