Parent

Class/Module Index [+]

Quicksearch

Webgen::Tag::Menu::MenuNode

Special menu node class. It encapsulates the original node for later access.

Attributes

children[R]

Array of the child nodes.

is_in_tree_of_files[W]

Set to true if the menu node is in the tree of files.

node[R]

The encapsulated node.

parent[R]

The parent node.

Public Class Methods

new(parent, node) click to toggle source

Create a new menu node under parent for the real node node.

# File lib/webgen/tag/menu.rb, line 26
def initialize(parent, node)
  @parent = parent
  @node = node
  @children = []
end

Public Instance Methods

is_in_tree_of_files?() click to toggle source

Return true if the menu node is in the menu tree of only files.

# File lib/webgen/tag/menu.rb, line 33
def is_in_tree_of_files?
  @is_in_tree_of_files
end
sort!() click to toggle source

Sort recursively all children of the node using the wrapped nodes.

# File lib/webgen/tag/menu.rb, line 38
def sort!
  self.children.sort! {|a,b| a.node <=> b.node}
  self.children.each {|child| child.sort!}
  self
end
to_lcn_list() click to toggle source

Return the menu tree under the node as nested list of alcn values.

# File lib/webgen/tag/menu.rb, line 45
def to_lcn_list
  self.children.inject([]) {|temp, n| temp << n.node.alcn; temp += ((t = n.to_lcn_list).empty? ? [] : [t]) }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.