Class: Postscript::Model::Operators::Arithmetic::Mod
- Inherits:
-
Postscript::Model::Operator
- Object
- Postscript::Model::Operator
- Postscript::Model::Operators::Arithmetic::Mod
- Defined in:
- lib/postscript/model/operators/arithmetic.rb
Instance Attribute Summary collapse
-
#operand_a ⇒ Object
readonly
Returns the value of attribute operand_a.
-
#operand_b ⇒ Object
readonly
Returns the value of attribute operand_b.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(operand_a:, operand_b:) ⇒ Mod
constructor
A new instance of Mod.
Methods inherited from Postscript::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(operand_a:, operand_b:) ⇒ Mod
Returns a new instance of Mod.
93 94 95 96 97 |
# File 'lib/postscript/model/operators/arithmetic.rb', line 93 def initialize(operand_a:, operand_b:) @operand_a = operand_a @operand_b = operand_b freeze end |
Instance Attribute Details
#operand_a ⇒ Object (readonly)
Returns the value of attribute operand_a.
92 93 94 |
# File 'lib/postscript/model/operators/arithmetic.rb', line 92 def operand_a @operand_a end |
#operand_b ⇒ Object (readonly)
Returns the value of attribute operand_b.
92 93 94 |
# File 'lib/postscript/model/operators/arithmetic.rb', line 92 def operand_b @operand_b end |
Class Method Details
.from_operands(stack) ⇒ Object
87 88 89 90 91 |
# File 'lib/postscript/model/operators/arithmetic.rb', line 87 def self.from_operands(stack) b = stack.pop_number.to_i a = stack.pop_number.to_i new(operand_a: a, operand_b: b) end |