Class: AsciiMath::AST::InfixOp
- Defined in:
- lib/asciimath/ast.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(operator, e1, e2) ⇒ InfixOp
constructor
A new instance of InfixOp.
- #operand1 ⇒ Object
- #operand2 ⇒ Object
- #operator ⇒ Object
- #to_s ⇒ Object
Methods inherited from InnerNode
Constructor Details
#initialize(operator, e1, e2) ⇒ InfixOp
Returns a new instance of InfixOp.
279 280 281 282 283 284 |
# File 'lib/asciimath/ast.rb', line 279 def initialize(operator, e1, e2) super() add(operator) add(e1) add(e2) end |
Instance Method Details
#==(o) ⇒ Object
303 304 305 |
# File 'lib/asciimath/ast.rb', line 303 def ==(o) o.class == self.class && o.operator == operator && o.operand1 == operand1 && o.operand2 == operand2 end |
#operand1 ⇒ Object
291 292 293 |
# File 'lib/asciimath/ast.rb', line 291 def operand1 child_nodes[1] end |
#operand2 ⇒ Object
295 296 297 |
# File 'lib/asciimath/ast.rb', line 295 def operand2 child_nodes[2] end |
#operator ⇒ Object
287 288 289 |
# File 'lib/asciimath/ast.rb', line 287 def operator child_nodes[0] end |
#to_s ⇒ Object
299 300 301 |
# File 'lib/asciimath/ast.rb', line 299 def to_s "#{operand1} #{operator} #{operand2}" end |