Class: RIO::FTP::Connection

Inherits:
Object show all
Defined in:
lib/rio/ftp/conncache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Connection

Returns a new instance of Connection.



45
46
47
48
49
50
# File 'lib/rio/ftp/conncache.rb', line 45

def initialize(uri)
  @uri = uri.clone
  @netftp = nil
  @remote_root = nil
  _init_connection()
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



62
63
64
# File 'lib/rio/ftp/conncache.rb', line 62

def method_missing(sym,*args,&block)
  @netftp.__send__(sym,*args,&block)
end

Instance Attribute Details

#netftpObject (readonly)

Returns the value of attribute netftp.



44
45
46
# File 'lib/rio/ftp/conncache.rb', line 44

def netftp
  @netftp
end

#remote_rootObject (readonly)

Returns the value of attribute remote_root.



44
45
46
# File 'lib/rio/ftp/conncache.rb', line 44

def remote_root
  @remote_root
end

#uriObject (readonly)

Returns the value of attribute uri.



44
45
46
# File 'lib/rio/ftp/conncache.rb', line 44

def uri
  @uri
end

Instance Method Details

#_init_connectionObject



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rio/ftp/conncache.rb', line 51

def _init_connection
  @netftp = ::Net::FTP.new()
  @netftp.connect(@uri.host,@uri.port)
  if @uri.user
    @netftp.(@uri.user,@uri.password)
  else
    @netftp.
  end
  @remote_root = @netftp.pwd
  @remote_root = '' if @remote_root == '/'
end