Class: Predicator::AST::Node
- Inherits:
-
Object
- Object
- Predicator::AST::Node
- Includes:
- Enumerable
- Defined in:
- lib/predicator/ast.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
Returns the value of attribute left.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(left) ⇒ Node
constructor
A new instance of Node.
- #literal? ⇒ Boolean
- #to_dot ⇒ Object
- #to_instructions ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
- #variable? ⇒ Boolean
Constructor Details
#initialize(left) ⇒ Node
Returns a new instance of Node.
8 9 10 |
# File 'lib/predicator/ast.rb', line 8 def initialize left @left = left end |
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left.
6 7 8 |
# File 'lib/predicator/ast.rb', line 6 def left @left end |
Instance Method Details
#each(&block) ⇒ Object
12 13 14 |
# File 'lib/predicator/ast.rb', line 12 def each &block Visitors::Each.new(block).accept self end |
#literal? ⇒ Boolean
33 |
# File 'lib/predicator/ast.rb', line 33 def literal?; false; end |
#to_dot ⇒ Object
16 17 18 |
# File 'lib/predicator/ast.rb', line 16 def to_dot Visitors::Dot.new.accept self end |
#to_instructions ⇒ Object
20 21 22 |
# File 'lib/predicator/ast.rb', line 20 def to_instructions Visitors::Instructions.new.accept self end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/predicator/ast.rb', line 24 def to_s Visitors::String.new.accept self end |
#type ⇒ Object
28 29 30 |
# File 'lib/predicator/ast.rb', line 28 def type raise NotImplementedError end |
#variable? ⇒ Boolean
32 |
# File 'lib/predicator/ast.rb', line 32 def variable?; false; end |