Module: Net::SSH::Test::Extensions::BufferedIo

Included in:
PacketStream
Defined in:
lib/net/ssh/test/extensions.rb

Overview

An extension to Net::SSH::BufferedIo (assumes that the underlying IO is actually a StringIO). Facilitates unit testing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#select_for_errorObject Also known as: select_for_error?

Set this to true if you want the IO to pretend to be in an error state



30
31
32
# File 'lib/net/ssh/test/extensions.rb', line 30

def select_for_error
  @select_for_error
end

#select_for_writeObject Also known as: select_for_write?

Set this to true if you want the IO to pretend to be available for writing



27
28
29
# File 'lib/net/ssh/test/extensions.rb', line 27

def select_for_write
  @select_for_write
end

Instance Method Details

#select_for_read?Boolean

Returns true if the position in the stream is less than the total length of the stream.

Returns:

  • (Boolean)


22
23
24
# File 'lib/net/ssh/test/extensions.rb', line 22

def select_for_read?
  pos < size
end