class HrrRbSftp::Sender

This class implements payload sender.

Public Class Methods

new(io_out) click to toggle source

Instantiates a new payload sender for the output IO.

@param io_out [IO] An IO for output.

# File lib/hrr_rb_sftp/sender.rb, line 13
def initialize io_out
  @io_out = io_out
end

Public Instance Methods

send(payload) click to toggle source

Sends payload_length then payload. Flushes output IO once payload is sent.

# File lib/hrr_rb_sftp/sender.rb, line 21
def send payload
  @io_out.write(Protocol::Common::DataTypes::Uint32.encode(payload.bytesize))
  @io_out.write(payload)
  @io_out.flush
end