Class: Omnium::Parser::AST::UnaryOperator

Inherits:
Base
  • Object
show all
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

Instance Method Summary collapse

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

#operandObject (readonly)

Returns the value of attribute operand.



10
11
12
# File 'lib/omnium/parser/ast/unary_operator.rb', line 10

def operand
  @operand
end

#operatorObject (readonly)

Returns the value of attribute operator.



10
11
12
# File 'lib/omnium/parser/ast/unary_operator.rb', line 10

def operator
  @operator
end