Class: Rampi::BinaryExpr
Instance Attribute Summary collapse
-
#left ⇒ Object
Returns the value of attribute left.
-
#op ⇒ Object
Returns the value of attribute op.
-
#right ⇒ Object
Returns the value of attribute right.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(op, left, right) ⇒ BinaryExpr
constructor
A new instance of BinaryExpr.
- #to_s ⇒ Object (also: #inspect)
Methods inherited from Node
#!=, #%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #^, #|, #~
Constructor Details
#initialize(op, left, right) ⇒ BinaryExpr
Returns a new instance of BinaryExpr.
28 29 30 31 32 |
# File 'lib/rampi/node.rb', line 28 def initialize(op, left, right) @op = op @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left.
26 27 28 |
# File 'lib/rampi/node.rb', line 26 def left @left end |
#op ⇒ Object
Returns the value of attribute op.
26 27 28 |
# File 'lib/rampi/node.rb', line 26 def op @op end |
#right ⇒ Object
Returns the value of attribute right.
26 27 28 |
# File 'lib/rampi/node.rb', line 26 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
39 40 41 |
# File 'lib/rampi/node.rb', line 39 def accept(visitor) visitor.visit_binary_expr(self) end |
#to_s ⇒ Object Also known as: inspect
34 35 36 |
# File 'lib/rampi/node.rb', line 34 def to_s "(#{@left} #{@op} #{@right})" end |