Class: URI::FTP
Instance Method Summary collapse
Instance Method Details
#checkout ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |