Sha256: 579b99e42c822e435e3cbc8b7f9bcd7b6da60294cf8ae504417e0fce4edb38db

Contents?: true

Size: 422 Bytes

Versions: 2

Compression:

Stored size: 422 Bytes

Contents

module Junoser
  module RuleTree
    class Node
      INDENT = '    '
      attr_reader :name, :children

      def initialize(name)
        @name = name
        @children = []
      end

      def <<(child)
        @children << child
      end

      def print(level = 0)
        puts INDENT * level + "- #{@name}"
        @children.each do |child|
          child.print level + 1
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
junoser-0.7.0 lib/junoser/rule_tree/node.rb
junoser-0.6.0 lib/junoser/rule_tree/node.rb