class FTPMVC::Ftpd::FileSystem

Public Class Methods

new(application) click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 10
def initialize(application)
  @application = application
end

Public Instance Methods

accessible?(path) click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 34
def accessible?(path)
  logger.debug { "FTPMVC::Ftpd::FileSystem#accessible?(#{path})" }
  true
end
dir(path) click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 14
def dir(path)
  logger.debug { "FTPMVC::Ftpd::FileSystem#dir(#{path})" }
  @application.index(path.gsub('/*', '')).map { |node| ::File.join(path, node.name) }
end
directory?(path) click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 19
def directory?(path)
  logger.debug { "FTPMVC::Ftpd::FileSystem#directory?(#{path})" }
  @application.directory?(path.gsub('/*', ''))
end
exists?(path) click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 39
def exists?(path)
  logger.debug { "FTPMVC::Ftpd::FileSystem#exists?(#{path})" }
  @application.exists?(path)
end
file_info(path) click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 44
def file_info(path)
  logger.debug { "FTPMVC::Ftpd::FileSystem#file_info(#{path})" }
  ::Ftpd::FileInfo.new(
    :ftype => directory?(path) ? 'directory' : 'file',
    :group => 'nogroup',
    :mode => directory?(path) ? 0750 : 0640,
    :mtime => Time.now,
    :nlink => 33,
    :owner => 'nobody',
    :path => path,
    :size => 0)
end
read(path) { |get| ... } click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 24
def read(path)
  logger.debug { "FTPMVC::Ftpd::FileSystem#read(#{path})" }
  yield @application.get(path)
end
write(path, stream) click to toggle source
# File lib/ftpmvc/ftpd/file_system.rb, line 29
def write(path, stream)
  logger.debug { "FTPMVC::Ftpd::FileSystem#write(#{path}, ...)" }
  @application.put(path, Input.new(stream))
end