Class: Whitespace::ISA::Putc

Inherits:
Instruction show all
Defined in:
lib/whitespace/instructions/io/putc.rb

Instance Attribute Summary collapse

Attributes inherited from Instruction

#vm

Instance Method Summary collapse

Constructor Details

#initialize(vm, console) ⇒ Putc

Returns a new instance of Putc.



5
6
7
8
# File 'lib/whitespace/instructions/io/putc.rb', line 5

def initialize(vm, console)
  super(vm)
  @console = console
end

Instance Attribute Details

#consoleObject (readonly)

Returns the value of attribute console.



3
4
5
# File 'lib/whitespace/instructions/io/putc.rb', line 3

def console
  @console
end

Instance Method Details

#executeObject



10
11
12
13
# File 'lib/whitespace/instructions/io/putc.rb', line 10

def execute
  n = vm.vstack.pop
  console.printc n
end