Class: Wallaby::Node

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

Overview

To present classes in tree structure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Node

Returns a new instance of Node.

Parameters:

  • klass (Class)


16
17
18
# File 'lib/tree/wallaby/node.rb', line 16

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#klassObject (readonly)

Represent the current class



8
9
10
# File 'lib/tree/wallaby/node.rb', line 8

def klass
  @klass
end

#parentObject

Represent the parent class of current class



11
12
13
# File 'lib/tree/wallaby/node.rb', line 11

def parent
  @parent
end

Instance Method Details

#childrenArray<Class>

Returns a list of children classes.

Returns:

  • (Array<Class>)

    a list of children classes



21
22
23
# File 'lib/tree/wallaby/node.rb', line 21

def children
  @children ||= []
end