Sha256: 7fe6e682e30977319a84566f35ab12b0aaa811afcd4e100db1462cc505e9a9a3

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

require 'constree/version'
require 'constree/node'

module Constree

  class << self

    def list node, seen=[]
      node = Node.new node unless node.is_a? Node
      seen << node if seen.empty?

      node.sub_nodes.each do |sub_n|
        seen << sub_n
        node.children_for_tree_graph << sub_n
        list(sub_n, seen) if sub_n.not_yet? seen
      end

      seen
    end

    def of mod
      list(mod).first.tree_graph
    end

    def html_of mod
      list(mod).first.tree_html_full
    end

    def p mod
      puts of mod
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
constree-0.1.8 lib/constree.rb