Method: Fog::Storage::Atmos::Directories#all

Defined in:
lib/fog/atmos/models/storage/directories.rb

#allObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/atmos/models/storage/directories.rb', line 14

def all
  directory ? ns = directory.key : ns = ''
  ns = ns + '/' unless ns =~ /\/$/
  data = service.get_namespace(ns).body[:DirectoryList]
  data = {:DirectoryEntry => []} if data.kind_of? String
  data[:DirectoryEntry] = [data[:DirectoryEntry]] if data[:DirectoryEntry].kind_of? Hash
  dirs = data[:DirectoryEntry].select {|de| de[:FileType] == 'directory'}
  dirs.each do |d|
    d[:Filename] = ns + d[:Filename] if directory
    d[:Filename] += '/' unless d[:Filename] =~ /\/$/
  end
  load(dirs)
end