Class: Postsvg::Model::Operators::Boolean::Bitshift

Inherits:
Postsvg::Model::Operator show all
Defined in:
lib/postsvg/model/operators/boolean.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:, shift:) ⇒ Bitshift

Returns a new instance of Bitshift.



173
174
175
176
177
# File 'lib/postsvg/model/operators/boolean.rb', line 173

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

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



172
173
174
# File 'lib/postsvg/model/operators/boolean.rb', line 172

def operand
  @operand
end

#shiftObject (readonly)

Returns the value of attribute shift.



172
173
174
# File 'lib/postsvg/model/operators/boolean.rb', line 172

def shift
  @shift
end

Class Method Details

.from_operands(stack) ⇒ Object



167
168
169
170
171
# File 'lib/postsvg/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