Implements the readdir operation. This will handle the continuous calls to readdir until the entire contents of the directory have been read, returning them in a single array.
Methods
Public Instance methods
Invoked when the server returns a list of "names". Requests readdir again, automatically.
[ show source ]
# File lib/net/sftp/operations/readdir.rb, line 35
35: def do_name( items )
36: @log.debug "[#{@id}] got #{items.length} items" if @log.debug?
37: @items.concat items
38: @driver.readdir @id, @handle
39: @session.register @id, self
40: end
Invoked when a status code is received from the server. If the code is FX_OK or FX_EOF then there is nothing left to read and the callback is invoked. Other status codes are handled by the superclass.
[ show source ]
# File lib/net/sftp/operations/readdir.rb, line 45
45: def do_status( code, message, language )
46: if code == FX_OK || code == FX_EOF
47: @callback[ OK, @items ]
48: else
49: super
50: end
51: end
Performs the operation.
[ show source ]
# File lib/net/sftp/operations/readdir.rb, line 27
27: def perform( handle )
28: @items = []
29: @handle = handle
30: @driver.readdir nil, @handle
31: end