Parent

Class 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.

parent[R]

The parent node.

node[R]

The encapsulated node.

is_in_tree_of_files[W]

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

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 27
27:       def initialize(parent, node)
28:         @parent = parent
29:         @node = node
30:         @children = []
31:       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 34
34:       def is_in_tree_of_files?
35:         @is_in_tree_of_files
36:       end
sort!() click to toggle source

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

    # File lib/webgen/tag/menu.rb, line 39
39:       def sort!
40:         self.children.sort! {|a,b| a.node <=> b.node}
41:         self.children.each {|child| child.sort!}
42:         self
43:       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 46
46:       def to_lcn_list
47:         self.children.inject([]) {|temp, n| temp << n.node.alcn; temp += ((t = n.to_lcn_list).empty? ? [] : [t]) }
48:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.