Module: NiFTP
- Defined in:
- lib/niftp.rb,
lib/niftp/version.rb
Overview
Abstracts away File Transfer Protocol plumbing, such as establishing and closing connections.
Constant Summary collapse
- VERSION =
"3.0.0"
Instance Method Summary collapse
-
#ftp(host, options = {}, &block) ⇒ Object
Connects to the
host
FTP server, executes the given block then closes the connection.
Instance Method Details
#ftp(host, options = {}, &block) ⇒ Object
Connects to the host
FTP server, executes the given block then closes the connection.
See the README for available options and examples.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/niftp.rb', line 14 def ftp(host, = {}, &block) = .merge() raise "The :tries option must be > 0." if [:tries] < 1 Retryable.retryable(()) do ftp = () begin login_with_timeout(ftp, host, ) yield ftp if ftp && block_given? ensure ftp.close if ftp end end end |