class SML::Tree
Attributes
child_list[RW]
parameter_name[RW]
parameter_value[RW]
Public Class Methods
construct(array_rep)
click to toggle source
# File lib/ruby-sml/sml-tree.rb, line 15 def self.construct(array_rep) return nil if array_rep.nil? parameter_name = array_rep.shift parameter_value = SML::ProcParameterValue.construct(array_rep.shift) child_list = [] child_list_array_rep = array_rep.shift unless child_list_array_rep.nil? child_list_array_rep.each do |entry_array_rep| entry = SML::Tree.construct(entry_array_rep) return nil if entry.nil? child_list << entry end end return SML::Tree.new(parameter_name, parameter_value, child_list) end
new(parameter_name, parameter_value, child_list)
click to toggle source
# File lib/ruby-sml/sml-tree.rb, line 9 def initialize(parameter_name, parameter_value, child_list) @parameter_name = parameter_name @parameter_value = parameter_value @child_list = child_list end
Public Instance Methods
to_a()
click to toggle source
# File lib/ruby-sml/sml-tree.rb, line 31 def to_a child_list_array = [] child_list.each do |entry| child_list_array << entry.to_a end return [] << parameter_name << SML::ProcParameterValue.to_a(parameter_value) << child_list_array end