Class: AsciiMath::AST::UnaryOp
- Defined in:
- lib/asciimath/ast.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(operator, e) ⇒ UnaryOp
constructor
A new instance of UnaryOp.
- #operand ⇒ Object
- #operator ⇒ Object
- #to_s ⇒ Object
Methods inherited from InnerNode
Constructor Details
#initialize(operator, e) ⇒ UnaryOp
Returns a new instance of UnaryOp.
225 226 227 228 229 |
# File 'lib/asciimath/ast.rb', line 225 def initialize(operator, e) super() add(operator) add(e) end |
Instance Method Details
#==(o) ⇒ Object
243 244 245 |
# File 'lib/asciimath/ast.rb', line 243 def ==(o) o.class == self.class && o.operator == operator && o.operand == operand end |
#operand ⇒ Object
235 236 237 |
# File 'lib/asciimath/ast.rb', line 235 def operand child_nodes[1] end |
#operator ⇒ Object
231 232 233 |
# File 'lib/asciimath/ast.rb', line 231 def operator child_nodes[0] end |
#to_s ⇒ Object
239 240 241 |
# File 'lib/asciimath/ast.rb', line 239 def to_s "#{operator} #{operand}" end |