Class: FTPMVC::Ftpd::FileSystem
- Inherits:
-
Object
- Object
- FTPMVC::Ftpd::FileSystem
- Includes:
- Logger
- Defined in:
- lib/ftpmvc/ftpd/file_system.rb
Instance Method Summary collapse
- #accessible?(path) ⇒ Boolean
- #dir(path) ⇒ Object
- #directory?(path) ⇒ Boolean
- #exists?(path) ⇒ Boolean
- #file_info(path) ⇒ Object
-
#initialize(application) ⇒ FileSystem
constructor
A new instance of FileSystem.
- #read(path) {|@application.get(path)| ... } ⇒ Object
- #write(path, stream) ⇒ Object
Methods included from Logger
Constructor Details
#initialize(application) ⇒ FileSystem
Returns a new instance of FileSystem.
10 11 12 |
# File 'lib/ftpmvc/ftpd/file_system.rb', line 10 def initialize(application) @application = application end |
Instance Method Details
#accessible?(path) ⇒ Boolean
34 35 36 37 |
# File 'lib/ftpmvc/ftpd/file_system.rb', line 34 def accessible?(path) logger.debug { "FTPMVC::Ftpd::FileSystem#accessible?(#{path})" } true end |
#dir(path) ⇒ Object
14 15 16 17 |
# 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) ⇒ Boolean
19 20 21 22 |
# 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) ⇒ Boolean
39 40 41 42 |
# 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) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# 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) {|@application.get(path)| ... } ⇒ Object
24 25 26 27 |
# File 'lib/ftpmvc/ftpd/file_system.rb', line 24 def read(path) logger.debug { "FTPMVC::Ftpd::FileSystem#read(#{path})" } yield @application.get(path) end |