Class: Postscript::Model::Operators::Boolean::Bitshift
- Inherits:
-
Postscript::Model::Operator
- Object
- Postscript::Model::Operator
- Postscript::Model::Operators::Boolean::Bitshift
- Defined in:
- lib/postscript/model/operators/boolean.rb
Instance Attribute Summary collapse
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
-
#shift ⇒ Object
readonly
Returns the value of attribute shift.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(operand:, shift:) ⇒ Bitshift
constructor
A new instance of Bitshift.
Methods inherited from Postscript::Model::Operator
#accept, #operator?, register_as
Constructor Details
#initialize(operand:, shift:) ⇒ Bitshift
Returns a new instance of Bitshift.
173 174 175 176 177 |
# File 'lib/postscript/model/operators/boolean.rb', line 173 def initialize(operand:, shift:) @operand = operand @shift = shift freeze end |
Instance Attribute Details
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
172 173 174 |
# File 'lib/postscript/model/operators/boolean.rb', line 172 def operand @operand end |
#shift ⇒ Object (readonly)
Returns the value of attribute shift.
172 173 174 |
# File 'lib/postscript/model/operators/boolean.rb', line 172 def shift @shift end |
Class Method Details
.from_operands(stack) ⇒ Object
167 168 169 170 171 |
# File 'lib/postscript/model/operators/boolean.rb', line 167 def self.from_operands(stack) shift = stack.pop_number.to_i value = stack.pop_number.to_i new(operand: value, shift: shift) end |