In Files

Parent

Node

Attributes

children[R]
level[RW]
name[RW]
parent[RW]

Public Class Methods

new(n = nil) click to toggle source
# File lib/rest.rb, line 70
def initialize n = nil
  @name = n
  @children = Array.new
  @level = 0
end

Public Instance Methods

add_child(c) click to toggle source
# File lib/rest.rb, line 76
def add_child c
  @children.push c
  c.parent = self
  c.level = @level + 1
end
all_children(type) click to toggle source
# File lib/rest.rb, line 109
def all_children type
  @result = Array.new
  @children.each do |child|
    if ( child.class == type )
      @result.push child
    end
    @result.concat( child.all_children( type ) )
  end
  @result
end
root() click to toggle source
# File lib/rest.rb, line 98
def root
  if parent
    return parent.root
  end
  return self
end
root?() click to toggle source
# File lib/rest.rb, line 94
def root?
  return !parent
end
to_s() click to toggle source
# File lib/rest.rb, line 105
def to_s
  @name
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.