Class: Keisan::AST::UnaryOperator
- Defined in:
- lib/keisan/ast/unary_operator.rb
Direct Known Subclasses
Indexing, UnaryBitwiseNot, UnaryIdentity, UnaryInverse, UnaryLogicalNot, UnaryMinus, UnaryPlus
Instance Attribute Summary
Attributes inherited from Parent
Instance Method Summary collapse
-
#initialize(children = []) ⇒ UnaryOperator
constructor
A new instance of UnaryOperator.
Methods inherited from Node
Constructor Details
#initialize(children = []) ⇒ UnaryOperator
Returns a new instance of UnaryOperator.
4 5 6 7 8 9 10 |
# File 'lib/keisan/ast/unary_operator.rb', line 4 def initialize(children = []) children = Array.wrap(children) super if children.count != 1 raise Keisan::Exceptions::ASTError.new("Unary operator takes has a single child") end end |