Class: ApiExplorer::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/api_explorer/node.rb

Direct Known Subclasses

Group, Request

Defined Under Namespace

Classes: NullNode

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#childrenObject

Returns the value of attribute children.



3
4
5
# File 'lib/api_explorer/node.rb', line 3

def children
  @children
end

#parentObject

Returns the value of attribute parent.



3
4
5
# File 'lib/api_explorer/node.rb', line 3

def parent
  @parent
end

#pathObject

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_pathObject



13
14
15
# File 'lib/api_explorer/node.rb', line 13

def full_path
  parent.full_path + path
end