Class: Relaxo::QueryServer::MockShell

Inherits:
Shell
  • Object
show all
Defined in:
lib/relaxo/query_server/shell.rb

Overview

Used primarily for testing, allows the input and output of the server to be provided directly.

Instance Attribute Summary

Attributes inherited from Shell

#input, #output

Instance Method Summary collapse

Methods inherited from Shell

#run

Constructor Details

#initializeMockShell

Returns a new instance of MockShell.



65
66
67
# File 'lib/relaxo/query_server/shell.rb', line 65

def initialize
	super [], []
end

Instance Method Details

#read_objectObject



69
70
71
72
73
74
75
# File 'lib/relaxo/query_server/shell.rb', line 69

def read_object
	if @input.size > 0
		@input.shift
	else
		raise EOFError.new("No more objects")
	end
end

#write_object(object) ⇒ Object



77
78
79
# File 'lib/relaxo/query_server/shell.rb', line 77

def write_object object
	@output << object
end