Class: Omnium::Parser::AST::UnaryOperator
- Defined in:
- lib/omnium/parser/ast/unary_operator.rb
Overview
Unary Operator represents a plus or minus on a number e.g. +1 or -5. That is an operator operating on one operand. @operator represents the unary operator token (plus or minus) and @operand represents another node (number or expression).
Instance Attribute Summary collapse
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
Instance Method Summary collapse
-
#initialize(operator, operand) ⇒ UnaryOperator
constructor
A new instance of UnaryOperator.
Constructor Details
#initialize(operator, operand) ⇒ UnaryOperator
Returns a new instance of UnaryOperator.
12 13 14 15 |
# File 'lib/omnium/parser/ast/unary_operator.rb', line 12 def initialize(operator, operand) @operator = operator @operand = operand end |
Instance Attribute Details
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
10 11 12 |
# File 'lib/omnium/parser/ast/unary_operator.rb', line 10 def operand @operand end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
10 11 12 |
# File 'lib/omnium/parser/ast/unary_operator.rb', line 10 def operator @operator end |