Class: Postscript::Model::Operators::Container::Length

Inherits:
Postscript::Model::Operator show all
Defined in:
lib/postscript/model/operators/container.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Postscript::Model::Operator

#accept, #operator?, register_as

Constructor Details

#initialize(operand:) ⇒ Length

Returns a new instance of Length.



10
11
12
13
# File 'lib/postscript/model/operators/container.rb', line 10

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

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



9
10
11
# File 'lib/postscript/model/operators/container.rb', line 9

def operand
  @operand
end

Class Method Details

.from_operands(stack) ⇒ Object



14
15
16
# File 'lib/postscript/model/operators/container.rb', line 14

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