Class: AsciiMath::AST::BinaryOp
- Defined in:
- lib/asciimath/ast.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(operator, e1, e2) ⇒ BinaryOp
constructor
A new instance of BinaryOp.
- #operand1 ⇒ Object
- #operand2 ⇒ Object
- #operator ⇒ Object
- #to_s ⇒ Object
Methods inherited from InnerNode
Constructor Details
#initialize(operator, e1, e2) ⇒ BinaryOp
Returns a new instance of BinaryOp.
249 250 251 252 253 254 |
# File 'lib/asciimath/ast.rb', line 249 def initialize(operator, e1, e2) super() add(operator) add(e1) add(e2) end |
Instance Method Details
#==(o) ⇒ Object
273 274 275 |
# File 'lib/asciimath/ast.rb', line 273 def ==(o) o.class == self.class && o.operator == operator && o.operand1 == operand1 && o.operand2 == operand2 end |
#operand1 ⇒ Object
261 262 263 |
# File 'lib/asciimath/ast.rb', line 261 def operand1 child_nodes[1] end |
#operand2 ⇒ Object
265 266 267 |
# File 'lib/asciimath/ast.rb', line 265 def operand2 child_nodes[2] end |
#operator ⇒ Object
257 258 259 |
# File 'lib/asciimath/ast.rb', line 257 def operator child_nodes[0] end |
#to_s ⇒ Object
269 270 271 |
# File 'lib/asciimath/ast.rb', line 269 def to_s "#{operator} #{operand1} #{operand2}" end |