Class

Session

Extends:

Includes:

Represents a single SFTP session, running atop an SSH session.

Public Attributes
status The status of the last synchronously executed operation. This is either nil, or an object that responds to :code, :message, and :language.
Public Methods
channel Return the underlying SSH channel that supports this SFTP connection. Useful for adding custom callbacks for some events, or for accessing the underlying connection beneath the channel.
close Closes the underlying SSH connection.
close_channel Closes the SFTP connection, but leaves the SSH connection open.
connect Waits for the underlying driver to reach a state of :open (or :closed). This makes it easier to use the SFTP routines synchronously without using the block form:
do_attrs Invoked by the underlying SFTP protocol layer when a SFTP attrs packet is received.
do_data Invoked by the underlying SFTP protocol layer when a SFTP data packet is received.
do_handle Invoked by the underlying SFTP protocol layer when a SFTP handle packet is received.
do_name Invoked by the underlying SFTP protocol layer when a SFTP name packet is received.
do_status Invoked by the underlying SFTP protocol layer when a SFTP status packet is received.
get_file Retrieves the given remote file to the given local path. This will overwrite any file at the local path name. The remote file must exist.
loop Delegates to Net::SSH::Session#loop. Causes the underlying SSH connection to process events as long as the given block returns true, or (if no block is given) until there are no more open channels.
method_missing Delegates the message to the operation that has been registered with the given name. If no such operation exists, control is passed to the superclass’ implementation of #method_missing.
new Create a new SFTP session on top of the given SSH session.
open_handle Opens the given remote file and returns a handle to it, which may be used with other operations (read, write, etc.). If a block is given, the handle will be yielded to it and closed when the block finishes, otherwise the handle will be returned. If the flags parameter is a numeric value, it must be a combination of IO constants, otherwise, it should be a string such as given to File.open.
put_file This stores the given local file at the given remote path. This will overwrite any file at the remote path name. The local file must exist.
register Registers the given handler with the given request id. This is used internally by the operations, so that the session knows who to delegate a response to that has been received from the server.
respond_to? Returns true if the object responds to the given symbol, or if there is an operation registered under the given symbol.
state Return the state of the SFTP connection. (See Net::SFTP::Protocol::Driver#state.)
support? Returns true if the underlying driver responds to the given symbol. This can be used by clients to determine whether the SFTP protocol version in use supports a particular operation.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.