Class: EXEL::ASTNode
- Inherits:
-
Object
- Object
- EXEL::ASTNode
- Defined in:
- lib/exel/ast_node.rb
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.
5 6 7 8 |
# File 'lib/exel/ast_node.rb', line 5 def initialize(instruction, children = []) @instruction = instruction @children = children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
3 4 5 |
# File 'lib/exel/ast_node.rb', line 3 def children @children end |
#instruction ⇒ Object (readonly)
Returns the value of attribute instruction.
3 4 5 |
# File 'lib/exel/ast_node.rb', line 3 def instruction @instruction end |
Instance Method Details
#add_child(node) ⇒ Object
18 19 20 |
# File 'lib/exel/ast_node.rb', line 18 def add_child(node) @children << node end |
#run(_context) ⇒ Object
14 15 16 |
# File 'lib/exel/ast_node.rb', line 14 def run(_context) fail "#{self.class} does not implement #process" end |
#start(context) ⇒ Object
10 11 12 |
# File 'lib/exel/ast_node.rb', line 10 def start(context) fail_silently { run(context) } end |