Class: ORB::AST::AbstractNode

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/ast/abstract_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*_args) ⇒ AbstractNode

Returns a new instance of AbstractNode.



8
9
10
11
# File 'lib/orb/ast/abstract_node.rb', line 8

def initialize(*_args)
  @children = []
  @errors = []
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



6
7
8
# File 'lib/orb/ast/abstract_node.rb', line 6

def attributes
  @attributes
end

#childrenObject

Returns the value of attribute children.



6
7
8
# File 'lib/orb/ast/abstract_node.rb', line 6

def children
  @children
end

#errorsObject

Returns the value of attribute errors.



6
7
8
# File 'lib/orb/ast/abstract_node.rb', line 6

def errors
  @errors
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
24
# File 'lib/orb/ast/abstract_node.rb', line 21

def ==(other)
  self.class == other.class &&
    @children == other.children
end

#add_child(node) ⇒ Object



13
14
15
# File 'lib/orb/ast/abstract_node.rb', line 13

def add_child(node)
  @children << node
end

#render(_context) ⇒ Object



17
18
19
# File 'lib/orb/ast/abstract_node.rb', line 17

def render(_context)
  raise "Not implemented - you must implement render in your subclass!"
end