Class: FTPMVC::Ftpd::FileSystem

Inherits:
Object
  • Object
show all
Defined in:
lib/ftpmvc/ftpd/file_system.rb

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ FileSystem

Returns a new instance of FileSystem.



4
5
6
# File 'lib/ftpmvc/ftpd/file_system.rb', line 4

def initialize(application)
  @application = application
end

Instance Method Details

#accessible?(path) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ftpmvc/ftpd/file_system.rb', line 20

def accessible?(path)
  true
end

#dir(path) ⇒ Object



8
9
10
# File 'lib/ftpmvc/ftpd/file_system.rb', line 8

def dir(path)
  @application.index(path[/^[^*]*/]).map { |node| ::File.join(path, node.name) }
end

#directory?(path) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ftpmvc/ftpd/file_system.rb', line 12

def directory?(path)
  @application.directory?(path)
end

#exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ftpmvc/ftpd/file_system.rb', line 24

def exists?(path)
  @application.exists?(path)
end

#file_info(path) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ftpmvc/ftpd/file_system.rb', line 28

def file_info(path)
  ::Ftpd::FileInfo.new(
    :ftype => directory?(path) ? 'directory' : 'file',
    :group => 'nogroup',
    :mode => 0777,
    :mtime => Time.now,
    :nlink => 33,
    :owner => 'nobody',
    :path => path,
    :size => 0)
end

#read(path) {|@application.get(path)| ... } ⇒ Object

Yields:

  • (@application.get(path))


16
17
18
# File 'lib/ftpmvc/ftpd/file_system.rb', line 16

def read(path)
  yield @application.get(path)
end