Class URI::FTP
In: lib/uri/ftp_ex.rb
Parent: Object

Methods

checkout  

Public Instance methods

[Source]

# File lib/uri/ftp_ex.rb, line 16
    def checkout
      tmp = TempPath.new('checkout', pathname.basename.to_s)

      begin
        Net::FTP.open(host) do |ftp|
          ftp.login
          ftp.passive = true
          ftp.getbinaryfile(path, tmp)
        end

      rescue Exception => ex
        tmp.unlink if tmp.exist?
        raise CheckoutError, "Cannot checkout #{to_s} (error: #{ex.short_pp})"
      end

      [tmp, nil]
    end

[Validate]