Class: ApiExplorer::Node
- Inherits:
-
Object
- Object
- ApiExplorer::Node
- Defined in:
- lib/api_explorer/node.rb
Defined Under Namespace
Classes: NullNode
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(parent = nil, children = nil, path = nil) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(parent = nil, children = nil, path = nil) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 10 11 |
# File 'lib/api_explorer/node.rb', line 5 def initialize(parent = nil, children = nil, path = nil) self.parent = parent || NullNode.new self.children = children || [] self.path = path.to_s self.children.each { |c| c.parent = self } end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
3 4 5 |
# File 'lib/api_explorer/node.rb', line 3 def children @children end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/api_explorer/node.rb', line 3 def parent @parent end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/api_explorer/node.rb', line 3 def path @path end |
Instance Method Details
#full_path ⇒ Object
13 14 15 |
# File 'lib/api_explorer/node.rb', line 13 def full_path parent.full_path + path end |