Class: FSR::FakeSocket
- Inherits:
-
Object
- Object
- FSR::FakeSocket
- Defined in:
- lib/fsr/fake_socket.rb
Instance Method Summary collapse
- #address ⇒ Object
- #close ⇒ Object
- #eof? ⇒ Boolean (also: #closed?)
- #fake_buffer ⇒ Object
- #fake_input ⇒ Object
- #hostname ⇒ Object
-
#initialize(remote_host, remote_port) ⇒ FakeSocket
constructor
A new instance of FakeSocket.
- #print(*args) ⇒ Object
- #read(len) ⇒ Object
Constructor Details
#initialize(remote_host, remote_port) ⇒ FakeSocket
Returns a new instance of FakeSocket.
7 8 9 10 11 12 |
# File 'lib/fsr/fake_socket.rb', line 7 def initialize(remote_host, remote_port) @remote_host, @remote_port = remote_host, remote_port @input = StringIO.new('') @buffer = [] end |
Instance Method Details
#address ⇒ Object
18 19 20 |
# File 'lib/fsr/fake_socket.rb', line 18 def address '127.0.0.1' end |
#close ⇒ Object
27 28 |
# File 'lib/fsr/fake_socket.rb', line 27 def close end |
#eof? ⇒ Boolean Also known as: closed?
22 23 24 |
# File 'lib/fsr/fake_socket.rb', line 22 def eof? @input.eof? end |
#fake_buffer ⇒ Object
42 43 44 |
# File 'lib/fsr/fake_socket.rb', line 42 def fake_buffer @buffer end |
#fake_input ⇒ Object
38 39 40 |
# File 'lib/fsr/fake_socket.rb', line 38 def fake_input @input end |
#hostname ⇒ Object
14 15 16 |
# File 'lib/fsr/fake_socket.rb', line 14 def hostname 'localhost' end |
#print(*args) ⇒ Object
30 31 32 |
# File 'lib/fsr/fake_socket.rb', line 30 def print(*args) @buffer << args.join end |
#read(len) ⇒ Object
34 35 36 |
# File 'lib/fsr/fake_socket.rb', line 34 def read(len) @input.read(len) end |