Class: Monster::Remote::Wrappers::NetFTP
- Inherits:
-
Object
- Object
- Monster::Remote::Wrappers::NetFTP
- Defined in:
- lib/monster/remote/wrappers/net_ftp.rb
Instance Method Summary collapse
-
#initialize(driver = Net::FTP) ⇒ NetFTP
constructor
A new instance of NetFTP.
- #open(host, user, password, port, &block) ⇒ Object
Constructor Details
#initialize(driver = Net::FTP) ⇒ NetFTP
Returns a new instance of NetFTP.
9 10 11 |
# File 'lib/monster/remote/wrappers/net_ftp.rb', line 9 def initialize(driver=Net::FTP) @driver = driver end |
Instance Method Details
#open(host, user, password, port, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/monster/remote/wrappers/net_ftp.rb', line 13 def open(host, user, password, port, &block) ftp = @driver.new ftp.connect(host, port) ftp.login(user, password) if block ftp.passive = true block.call(NetFTPHandler.new(ftp), ftp) end ftp.close end |