Class: Postscript::Model::Operators::Container::Getinterval

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:, start:, count:) ⇒ Getinterval

Returns a new instance of Getinterval.



54
55
56
57
58
59
# File 'lib/postscript/model/operators/container.rb', line 54

def initialize(operand:, start:, count:)
  @operand = operand
  @start = start
  @count = count
  freeze
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



53
54
55
# File 'lib/postscript/model/operators/container.rb', line 53

def count
  @count
end

#operandObject (readonly)

Returns the value of attribute operand.



53
54
55
# File 'lib/postscript/model/operators/container.rb', line 53

def operand
  @operand
end

#startObject (readonly)

Returns the value of attribute start.



53
54
55
# File 'lib/postscript/model/operators/container.rb', line 53

def start
  @start
end

Class Method Details

.from_operands(stack) ⇒ Object



60
61
62
63
64
65
# File 'lib/postscript/model/operators/container.rb', line 60

def self.from_operands(stack)
  count = stack.pop_number.to_i
  start = stack.pop_number.to_i
  coll = stack.pop
  new(operand: coll, start: start, count: count)
end