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.



85
86
87
# File 'lib/relaxo/query_server/shell.rb', line 85

def initialize
	super [], []
end

Instance Method Details

#read_objectObject



89
90
91
92
93
94
95
# File 'lib/relaxo/query_server/shell.rb', line 89

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

#write_object(object) ⇒ Object



97
98
99
# File 'lib/relaxo/query_server/shell.rb', line 97

def write_object object
	@output << object
end