Class: Postscript::Model::Operators::Arithmetic::Neg

Inherits:
Postscript::Model::Operator show all
Defined in:
lib/postscript/model/operators/arithmetic.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postscript::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(operand:) ⇒ Neg

Returns a new instance of Neg.



103
104
105
106
# File 'lib/postscript/model/operators/arithmetic.rb', line 103

def initialize(operand:)
  @operand = operand
  freeze
end

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



102
103
104
# File 'lib/postscript/model/operators/arithmetic.rb', line 102

def operand
  @operand
end

Class Method Details

.from_operands(stack) ⇒ Object



107
108
109
# File 'lib/postscript/model/operators/arithmetic.rb', line 107

def self.from_operands(stack)
  new(operand: stack.pop_number)
end