Class: EXEL::ASTNode
- Inherits:
-
Object
- Object
- EXEL::ASTNode
- Defined in:
- lib/exel/ast_node.rb
Overview
An abstract class that serves as the parent class of nodes in the AST
Direct Known Subclasses
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#instruction ⇒ Object
readonly
Returns the value of attribute instruction.
Instance Method Summary collapse
- #add_child(node) ⇒ Object
-
#initialize(instruction, children = []) ⇒ ASTNode
constructor
A new instance of ASTNode.
- #run(_context) ⇒ Object
- #start(context) ⇒ Object
Constructor Details
#initialize(instruction, children = []) ⇒ ASTNode
Returns a new instance of ASTNode.
7 8 9 10 |
# File 'lib/exel/ast_node.rb', line 7 def initialize(instruction, children = []) @instruction = instruction @children = children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
5 6 7 |
# File 'lib/exel/ast_node.rb', line 5 def children @children end |
#instruction ⇒ Object (readonly)
Returns the value of attribute instruction.
5 6 7 |
# File 'lib/exel/ast_node.rb', line 5 def instruction @instruction end |
Instance Method Details
#add_child(node) ⇒ Object
22 23 24 |
# File 'lib/exel/ast_node.rb', line 22 def add_child(node) @children << node end |
#run(_context) ⇒ Object
18 19 20 |
# File 'lib/exel/ast_node.rb', line 18 def run(_context) raise "#{self.class} does not implement #process" end |
#start(context) ⇒ Object
12 13 14 15 16 |
# File 'lib/exel/ast_node.rb', line 12 def start(context) run(context) rescue EXEL::Error::JobTermination => e EXEL.logger.send(e.cmd, "JobTerminationError: #{e.message.chomp}") end |