Class: Infrataster::Contexts::FtpContext
- Inherits:
-
BaseContext
- Object
- BaseContext
- Infrataster::Contexts::FtpContext
- Defined in:
- lib/infrataster/contexts/ftp_context.rb
Overview
FTP Context
Instance Method Summary collapse
Instance Method Details
#result ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/infrataster/contexts/ftp_context.rb', line 8 def result = {} if server.[:ftp] = .merge(server.[:ftp]) end resource.ftp = Net::FTP.open(server.address, user = [:user], pass = [:pass], acct = nil) command, argument = resource.command.split response = '' if resource.ftp.respond_to?(command) response = resource.ftp.method(command).call if argument.nil? response = resource.ftp.method(command).call(argument) if argument resource.ftp.method('close').call end return response.join if response.is_a?(Array) response end |