class Arbolobra::Node

Attributes

children[R]
value[R]

Public Class Methods

new(value, *children) click to toggle source
# File lib/arbolobra/node.rb, line 14
def initialize value, *children
  @children = if children.size == 1 && children.first.class == Array
                children.first
              else
                children
              end
  @value = value
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/arbolobra/node.rb, line 32
def <=> other
  cmp = value <=> other.value
  if cmp == 0
    cmp = children <=> other.children
  end
  cmp
end
print(intro: "", lead: "", output: $stdout, charset: Arbolobra::CharSet::DEFAULT) click to toggle source
to_s() click to toggle source
# File lib/arbolobra/node.rb, line 28
def to_s
  "value: #{@value}, #{@children && @children.size}"
end