Class: Postsvg::Model::Operators::Arithmetic::Neg
- Inherits:
-
Postsvg::Model::Operator
- Object
- Postsvg::Model::Operator
- Postsvg::Model::Operators::Arithmetic::Neg
- Defined in:
- lib/postsvg/model/operators/arithmetic.rb
Instance Attribute Summary collapse
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(operand:) ⇒ Neg
constructor
A new instance of Neg.
Methods inherited from Postsvg::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(operand:) ⇒ Neg
Returns a new instance of Neg.
103 104 105 106 |
# File 'lib/postsvg/model/operators/arithmetic.rb', line 103 def initialize(operand:) @operand = operand freeze end |
Instance Attribute Details
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
102 103 104 |
# File 'lib/postsvg/model/operators/arithmetic.rb', line 102 def operand @operand end |
Class Method Details
.from_operands(stack) ⇒ Object
107 108 109 |
# File 'lib/postsvg/model/operators/arithmetic.rb', line 107 def self.from_operands(stack) new(operand: stack.pop_number) end |