Class: Monster::Remote::Wrappers::NetFTP

Inherits:
Object
  • Object
show all
Defined in:
lib/monster/remote/wrappers/net_ftp.rb

Instance Method Summary collapse

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.(user, password)
  if block
    ftp.passive = true
    block.call(NetFTPHandler.new(ftp), ftp)
  end
  ftp.close
end