Class: IntIfInstruction

Inherits:
Instruction show all
Includes:
IfInstruction
Defined in:
lib/instructions/int/int_if.rb

Overview

pops the top 2 items of the :int stack, and one :bool; returns the top :int item if the :bool is false, the second one if true

needs: 2 :int, 1 :bool

pushes: 1 :int

Instance Attribute Summary

Attributes included from IfInstruction

#target_stack

Attributes inherited from Instruction

#context

Instance Method Summary collapse

Methods included from IfInstruction

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

Methods inherited from Instruction

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

Constructor Details

#initialize(context) ⇒ IntIfInstruction

Returns a new instance of IntIfInstruction.



13
14
15
# File 'lib/instructions/int/int_if.rb', line 13

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