Class: ORB::AST::AbstractNode
- Inherits:
-
Object
- Object
- ORB::AST::AbstractNode
show all
- Defined in:
- lib/orb/ast/abstract_node.rb
Constant Summary
collapse
- EMPTY_ARRAY =
[].freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractNode.
11
12
13
|
# File 'lib/orb/ast/abstract_node.rb', line 11
def initialize(*_args)
@children = []
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6
7
8
|
# File 'lib/orb/ast/abstract_node.rb', line 6
def attributes
@attributes
end
|
#children ⇒ Object
Returns the value of attribute children.
6
7
8
|
# File 'lib/orb/ast/abstract_node.rb', line 6
def children
@children
end
|
#errors ⇒ Object
15
16
17
|
# File 'lib/orb/ast/abstract_node.rb', line 15
def errors
@errors || EMPTY_ARRAY
end
|
Instance Method Details
#==(other) ⇒ Object
31
32
33
34
|
# File 'lib/orb/ast/abstract_node.rb', line 31
def ==(other)
self.class == other.class &&
@children == other.children
end
|
#add_child(node) ⇒ Object
19
20
21
|
# File 'lib/orb/ast/abstract_node.rb', line 19
def add_child(node)
@children << node
end
|
#add_error(error) ⇒ Object
23
24
25
|
# File 'lib/orb/ast/abstract_node.rb', line 23
def add_error(error)
(@errors ||= []) << error
end
|
#render(_context) ⇒ Object
27
28
29
|
# File 'lib/orb/ast/abstract_node.rb', line 27
def render(_context)
raise "Not implemented - you must implement render in your subclass!"
end
|