-
-
Save chuckg/3266931 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TreeNode | |
attr_accessor :nodeType, :value, :children | |
def initialize(nodeType, value, children=[]) | |
raise Exception unless children.is_a?(Array) | |
@nodeType = nodeType | |
@value = value | |
@children = children | |
end | |
end | |
tn = TreeNode.new("Answer", "child value") | |
tnRoot = TreeNode.new("Decision", "Root", [tn]) | |
tnRoot.children.each do |node| | |
puts node.value | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment