Class: Ftpd::DiskFileSystem

Inherits:
Object
  • Object
show all
Includes:
Append, Base, Delete, List, Mkdir, Read, Rename, Rmdir, Write
Defined in:
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb,
lib/ftpd/disk_file_system.rb

Overview

An FTP file system mapped to a disk directory. This can serve as a template for creating your own specialized driver.

Any method may raise a PermanentFileSystemError (e.g. “file not found”) or TransientFileSystemError (e.g. “file busy”). A PermanentFileSystemError will cause a “550” error response to be sent; a TransientFileSystemError will cause a “450” error response to be sent.

The class is divided into modules that may be included piecemeal. By including some mixins and not others, you can compose a disk file system driver “a la carte.” This is useful if you want an FTP server that, for example, allows reading but not writing files.

Defined Under Namespace

Modules: Accessors, Append, Base, Delete, List, Mkdir, PathExpansion, Read, Rename, Rmdir, Write

Instance Method Summary collapse

Methods included from Write

#write

Methods included from TranslateExceptions

included, #translate_exception

Methods included from Rmdir

#rmdir

Methods included from Rename

#rename

Methods included from Read

#read

Methods included from Mkdir

#mkdir

Methods included from List

#dir, #file_info

Methods included from Delete

#delete

Methods included from Append

#append

Methods included from PathExpansion

#expand_ftp_path, #set_data_dir

Methods included from Accessors

#accessible?, #directory?, #exists?

Constructor Details

#initialize(data_dir) ⇒ DiskFileSystem

Make a new instance to serve a directory. data_dir should be an absolute path.



383
384
385
386
# File 'lib/ftpd/disk_file_system.rb', line 383

def initialize(data_dir)
  set_data_dir data_dir
  translate_exception SystemCallError
end