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.
8 9 10 11 |
# File 'lib/exel/ast_node.rb', line 8 def initialize(instruction, children: []) @instruction = instruction @children = children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
6 7 8 |
# File 'lib/exel/ast_node.rb', line 6 def children @children end |
#instruction ⇒ Object (readonly)
Returns the value of attribute instruction.
6 7 8 |
# File 'lib/exel/ast_node.rb', line 6 def instruction @instruction end |
Instance Method Details
#add_child(node) ⇒ Object
23 24 25 |
# File 'lib/exel/ast_node.rb', line 23 def add_child(node) @children << node end |
#run(_context) ⇒ Object
19 20 21 |
# File 'lib/exel/ast_node.rb', line 19 def run(_context) raise "#{self.class} does not implement #process" end |
#start(context) ⇒ Object
13 14 15 16 17 |
# File 'lib/exel/ast_node.rb', line 13 def start(context) run(context) rescue EXEL::Error::JobTermination => e EXEL.logger.send(e.cmd, "JobTerminationError: #{e..chomp}") end |