Method: Fog::Storage::Local::Files#all

Defined in:
lib/fog/local/models/storage/files.rb

#allObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/local/models/storage/files.rb', line 12

def all
  requires :directory
  if directory.collection.get(directory.key)
    data = []
    Dir.chdir(service.path_to(directory.key)) {
      data = Dir.glob('**/*').reject do |file|
        ::File.directory?(file)
      end.map do |key|
        path = file_path(key)
        {
          :content_length => ::File.size(path),
          :key            => key,
          :last_modified  => ::File.mtime(path)
        }
      end
    }
    load(data)
  else
    nil
  end
end