Class: Postsvg::Model::Operators::Arithmetic::Sqrt

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:) ⇒ Sqrt

Returns a new instance of Sqrt.



175
176
177
178
# File 'lib/postsvg/model/operators/arithmetic.rb', line 175

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

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



174
175
176
# File 'lib/postsvg/model/operators/arithmetic.rb', line 174

def operand
  @operand
end

Class Method Details

.from_operands(stack) ⇒ Object



179
180
181
# File 'lib/postsvg/model/operators/arithmetic.rb', line 179

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