class Titania::Connection
Attributes
connect[RW]
Public Class Methods
new(host,username,password)
click to toggle source
# File lib/Titania.rb, line 9 def initialize(host,username,password) self.connect = Net::FTP::new(host, username, password) end
Public Instance Methods
change_dir(path)
click to toggle source
# File lib/Titania.rb, line 24 def change_dir(path) # Change dir self.connect.chdir(path) end
change_name(f_name, c_name)
click to toggle source
# File lib/Titania.rb, line 54 def change_name(f_name, c_name) # Change file or directory name self.connect.rename(f_name, c_name) end
close()
click to toggle source
# File lib/Titania.rb, line 78 def close # close connection self.connect.close end
connection_status()
click to toggle source
# File lib/Titania.rb, line 69 def connection_status # Connection status if self.connect.closed? puts "Connection is closed !" else puts "Connection is active !" end end
create_dir(path, dir_name)
click to toggle source
# File lib/Titania.rb, line 36 def create_dir(path, dir_name) # Create dir self.connect.mkdir(path + "/" + dir_name) end
current_dir()
click to toggle source
# File lib/Titania.rb, line 19 def current_dir # get current dir self.connect.pwd end
delete_file(path, file_name)
click to toggle source
# File lib/Titania.rb, line 30 def delete_file(path, file_name) # Delete file self.connect.delete(path + "/" + file_name) end
file_size(file)
click to toggle source
# File lib/Titania.rb, line 64 def file_size(file) # Get File Size self.connect.size(file) end
get_list(path = '/')
click to toggle source
# File lib/Titania.rb, line 13 def get_list(path = '/') # File List / Return Array result = self.connect.list(path) end
help(argv = nil)
click to toggle source
# File lib/Titania.rb, line 43 def help(argv = nil) # Help cmd = "HELP" if argv cmd = cmd + " " + argv end self.connect.sendcmd(cmd) end
remove_dir(dir)
click to toggle source
# File lib/Titania.rb, line 59 def remove_dir(dir) # Remove dir self.connect.rmdir(dir) end