Class: Poro::ContextFactories::NamespaceFactory::CacheNode

Inherits:
Object
  • Object
show all
Defined in:
lib/poro/context_factories/namespace_factory.rb

Overview

The internal class used to manage the namespace tree. This should never be used outside of this factory.

This class stores the child notes for the namespace, as well as the factory for this level in the namespace.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCacheNode

Initialize an empty node.



93
94
95
96
# File 'lib/poro/context_factories/namespace_factory.rb', line 93

def initialize
  @children = {}
  @factory = nil
end

Instance Attribute Details

#childrenObject (readonly)

Returns the children–as a hash. The keys are the module/class name, and the values are the associated child node.

This is the raw hash and can be manipulated directly.



102
103
104
# File 'lib/poro/context_factories/namespace_factory.rb', line 102

def children
  @children
end

#factoryObject

Returns the factory for this node, or nil if there is none.



105
106
107
# File 'lib/poro/context_factories/namespace_factory.rb', line 105

def factory
  @factory
end

Instance Method Details

#to_sObject



110
111
112
# File 'lib/poro/context_factories/namespace_factory.rb', line 110

def to_s
  return {:factory => factory, :children => children}.inspect
end