Class: RIO::FTP::Connection
Instance Attribute Summary collapse
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
-
#netftp ⇒ Object
readonly
Returns the value of attribute netftp.
-
#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
- #remote_root ⇒ Object
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
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
33 34 35 |
# File 'lib/rio/ftp/conncache.rb', line 33 def encoding @encoding end |
#netftp ⇒ Object (readonly)
Returns the value of attribute netftp.
33 34 35 |
# File 'lib/rio/ftp/conncache.rb', line 33 def netftp @netftp end |
#uri ⇒ Object (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_connection ⇒ Object
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.login(@uri.user,@uri.password) else @netftp.login end @remote_root = @netftp.pwd @encoding = @remote_root.encoding end |
#remote_root ⇒ Object
41 42 43 |
# File 'lib/rio/ftp/conncache.rb', line 41 def remote_root @remote_root end |