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.



34
35
36
37
38
39
40
# File 'lib/rio/ftp/conncache.rb', line 34

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



55
56
57
# File 'lib/rio/ftp/conncache.rb', line 55

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

Instance Attribute Details

#encodingObject (readonly)

Returns the value of attribute encoding.



33
34
35
# File 'lib/rio/ftp/conncache.rb', line 33

def encoding
  @encoding
end

#netftpObject (readonly)

Returns the value of attribute netftp.



33
34
35
# File 'lib/rio/ftp/conncache.rb', line 33

def netftp
  @netftp
end

#uriObject (readonly)

Returns the value of attribute uri.



33
34
35
# File 'lib/rio/ftp/conncache.rb', line 33

def uri
  @uri
end

Instance Method Details

#_init_connectionObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rio/ftp/conncache.rb', line 44

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

#remote_rootObject



41
42
43
# File 'lib/rio/ftp/conncache.rb', line 41

def remote_root
  @remote_root
end