Class: RIO::FTP::Connection
Instance Attribute Summary collapse
-
#netftp ⇒ Object
readonly
Returns the value of attribute netftp.
-
#remote_root ⇒ Object
readonly
Returns the value of attribute remote_root.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #_init_connection ⇒ Object
-
#initialize(uri) ⇒ Connection
constructor
A new instance of Connection.
- #method_missing(sym, *args, &block) ⇒ Object
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
#netftp ⇒ Object (readonly)
Returns the value of attribute netftp.
44 45 46 |
# File 'lib/rio/ftp/conncache.rb', line 44 def netftp @netftp end |
#remote_root ⇒ Object (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 |
#uri ⇒ Object (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_connection ⇒ Object
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.login(@uri.user,@uri.password) else @netftp.login end @remote_root = @netftp.pwd @remote_root = '' if @remote_root == '/' end |