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


32
33
34
# File 'lib/net/ssh/test/extensions.rb', line 32

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


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

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)

24
25
26
# File 'lib/net/ssh/test/extensions.rb', line 24

def select_for_read?
  pos < size
end