Class: IntYankInstruction

Inherits:
Instruction show all
Includes:
YankInstruction
Defined in:
lib/instructions/int/int_yank.rb

Overview

pops the top item of the :int stack (the “index”); repositions an item from down “inside” the :int stack to its top.

If the index value is negative or 0, the bottom item on the stack is moved; if the index value is greater than or equal to the depth of the stack, there is no change; otherwise, the index value refers to the bottom-to-top order of stack items.

note: the destination depth is calculated after the index has been popped

needs: 2 :int

pushes: 1 :int

Instance Attribute Summary

Attributes included from YankInstruction

#target_stack

Attributes inherited from Instruction

#context

Instance Method Summary collapse

Methods included from YankInstruction

#cleanup, #derive, #preconditions?, #setup

Methods inherited from Instruction

all_instructions, #cleanup, #derive, #go, inherited, #needs, #preconditions?, #pushes, #setup, to_nudgecode

Constructor Details

#initialize(context) ⇒ IntYankInstruction

Returns a new instance of IntYankInstruction.



17
18
19
# File 'lib/instructions/int/int_yank.rb', line 17

def initialize(context)
  super(context, :int)
end