Class: NameYankdupInstruction
- Inherits:
-
Instruction
- Object
- Instruction
- NameYankdupInstruction
- Includes:
- YankdupInstruction
- Defined in:
- lib/instructions/name/name_yankdup.rb
Overview
pops the top item of the :int
stack (the “index”); pushes a duplicate of an item from down “inside” the :name
stack to its top.
If the index value is negative or 0, the bottom item on the stack is copied; if the index value is greater than or equal to the depth of the stack, the top item is copied; otherwise, the index value refers to the bottom-to-top order of stack items.
needs: 1 :int
, 1 :name
pushes: 1 :name
(sortof)
Instance Attribute Summary
Attributes included from YankdupInstruction
Attributes inherited from Instruction
Instance Method Summary collapse
-
#initialize(context) ⇒ NameYankdupInstruction
constructor
A new instance of NameYankdupInstruction.
Methods included from YankdupInstruction
#cleanup, #derive, #preconditions?, #setup
Methods inherited from Instruction
all_instructions, #cleanup, #derive, #go, inherited, #needs, #preconditions?, #pushes, #setup, to_nudgecode
Constructor Details
#initialize(context) ⇒ NameYankdupInstruction
Returns a new instance of NameYankdupInstruction.
15 16 17 |
# File 'lib/instructions/name/name_yankdup.rb', line 15 def initialize(context) super(context, :name) end |