class Beckett::Node::Base

Attributes

children[R]
node[R]
position[R]

Public Class Methods

new(node) click to toggle source
# File lib/beckett/node.rb, line 17
def initialize(node)
  @node     = node
  @children = []
  @position = $position
  $position += 1
end

Public Instance Methods

<<(nodes) click to toggle source
# File lib/beckett/node.rb, line 36
def <<(nodes)
  @children += ([nodes].flatten)
end
inspect() click to toggle source
# File lib/beckett/node.rb, line 24
def inspect
  "<#{node_name} position=#{position}>"
end
to_h() click to toggle source
# File lib/beckett/node.rb, line 32
def to_h
  raise NotImplementedError
end
to_s() click to toggle source
# File lib/beckett/node.rb, line 28
def to_s
  inspect
end

Private Instance Methods

node_name() click to toggle source
# File lib/beckett/node.rb, line 42
def node_name
  @node_name ||= node.type.upcase
end