Module: Ftpd::TranslateExceptions::ClassMethods

Defined in:
lib/ftpd/translate_exceptions.rb

Instance Method Summary collapse

Instance Method Details

#translate_exceptions(method_name) ⇒ Object

Cause the named method to translate exceptions.



43
44
45
46
47
48
49
50
51
# File 'lib/ftpd/translate_exceptions.rb', line 43

def translate_exceptions(method_name)
  original_method = instance_method(method_name)
  remove_method(method_name)
  define_method(method_name) do |*args, &block|
    exception_translator.translate_exceptions do
      original_method.bind(self).call(*args, &block)
    end
  end
end