Class: DebugIO

Inherits:
Object
  • Object
show all
Defined in:
lib/gpstool/extensions/debug_io.rb

Overview

This file is part of the “GPSTool” project, and is distributed under the MIT License. Copyright © 2011 Samuel G. D. Williams. <www.oriontransfer.co.nz> See <LICENSE.txt> for licensing details.

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ DebugIO

Returns a new instance of DebugIO.



6
7
8
# File 'lib/gpstool/extensions/debug_io.rb', line 6

def initialize(io)
	@io = io
end

Instance Method Details

#getcObject



34
35
36
37
38
39
40
# File 'lib/gpstool/extensions/debug_io.rb', line 34

def getc
	char = @io.getc

	$stderr.puts "(getc) -> " + char.chr

	return char
end

#gets(eol = "\r\n") ⇒ Object



26
27
28
29
30
31
32
# File 'lib/gpstool/extensions/debug_io.rb', line 26

def gets(eol = "\r\n")
	buffer = @io.gets(eol)

	$stderr.puts "(gets) -> " + buffer.dump

	return buffer
end

#read(count) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/gpstool/extensions/debug_io.rb', line 18

def read(count)
	buffer = @io.read(count)

	$stderr.puts "(read) -> " + buffer.dump

	return buffer
end

#readbytes(count) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/gpstool/extensions/debug_io.rb', line 10

def readbytes(count)
	buffer = @io.readbytes(count)

	$stderr.puts "(readbytes) -> " + buffer.dump

	return buffer
end

#ungetc(c) ⇒ Object



42
43
44
# File 'lib/gpstool/extensions/debug_io.rb', line 42

def ungetc(c)
	@io.ungetc(c)
end