Class: Ftpd::FileSystemErrorTranslator

Inherits:
Object
  • Object
show all
Includes:
Error
Defined in:
lib/ftpd/file_system_error_translator.rb

Overview

A proxy file system driver that sends a “450” or “550” error reply in response to FileSystemError exceptions.

Instance Method Summary collapse

Methods included from Error

#error, #permanent_error, #sequence_error, #transient_error, #unimplemented_error, #unrecognized_error

Constructor Details

#initialize(file_system) ⇒ FileSystemErrorTranslator

Returns a new instance of FileSystemErrorTranslator.



10
11
12
# File 'lib/ftpd/file_system_error_translator.rb', line 10

def initialize(file_system)
  @file_system = file_system
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/ftpd/file_system_error_translator.rb', line 18

def method_missing(method, *args)
  @file_system.send(method, *args)
rescue PermanentFileSystemError => e
  permanent_error e
rescue TransientFileSystemError => e
  transient_error e
rescue FileSystemError => e
  permanent_error e
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/ftpd/file_system_error_translator.rb', line 14

def respond_to?(method)
  @file_system.respond_to?(method) || super
end