Class: Postsvg::Model::Operators::Arithmetic::Abs

Inherits:
Postsvg::Model::Operator show all
Defined in:
lib/postsvg/model/operators/arithmetic.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postsvg::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(operand:) ⇒ Abs

Returns a new instance of Abs.



115
116
117
118
# File 'lib/postsvg/model/operators/arithmetic.rb', line 115

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

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



114
115
116
# File 'lib/postsvg/model/operators/arithmetic.rb', line 114

def operand
  @operand
end

Class Method Details

.from_operands(stack) ⇒ Object



119
120
121
# File 'lib/postsvg/model/operators/arithmetic.rb', line 119

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