class FTPMVC::Application

Public Class Methods

new(&block) click to toggle source
# File lib/ftpmvc/application.rb, line 15
def initialize(&block)
  @fs = Directory.new
  @filter_chain = Filter::FilesystemAccess.new(@fs, nil)
  instance_eval(&block) if block_given?
end

Public Instance Methods

auth() click to toggle source
# File lib/ftpmvc/application.rb, line 21
def auth
  @authenticator ||= Authenticator::Promiscuous.new
end
handle_exception(e) click to toggle source
# File lib/ftpmvc/application.rb, line 25
def handle_exception(e)
  logger.error %Q[#{e.class}: #{e.message}\n#{e.backtrace.join("\n")}]
  @exception_handler.call(e) unless @exception_handler.nil?
end

Protected Instance Methods

authenticator(authenticator, options={}) click to toggle source
# File lib/ftpmvc/application.rb, line 43
def authenticator(authenticator, options={})
  if authenticator.kind_of?(Symbol)
    authenticator = FTPMVC::Authenticator.const_get(authenticator.to_s.camelize)
  end
  if authenticator.kind_of?(Class)
    authenticator = authenticator.new(options)
  end
  @authenticator = authenticator
end
filesystem(&block) click to toggle source
# File lib/ftpmvc/application.rb, line 53
def filesystem(&block)
  @fs.instance_eval(&block)
end
filter(filter, options={}) click to toggle source
# File lib/ftpmvc/application.rb, line 36
def filter(filter, options={})
  if filter.kind_of?(Symbol)
    filter = FTPMVC::Filter.const_get(filter.to_s.camelize)
  end
  @filter_chain = filter.new(@fs, @filter_chain, options)
end
on_exception(&block) click to toggle source
# File lib/ftpmvc/application.rb, line 32
def on_exception(&block)
  @exception_handler = block
end