Class: Fog::Storage::Atmos::Directory

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/atmos/models/storage/directory.rb

Instance Method Summary collapse

Instance Method Details

#destroy(opts = {}) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/atmos/models/storage/directory.rb', line 35

def destroy(opts={})
  if opts[:recursive]
    files.each {|f| f.destroy }
    directories.each do |d|
      d.files.each {|f| f.destroy }
      d.destroy(opts)
    end
  end
  service.delete_namespace key
end

#directoriesObject



19
20
21
22
23
24
25
26
# File 'lib/fog/atmos/models/storage/directory.rb', line 19

def directories
  @directories ||= begin
                     Fog::Storage::Atmos::Directories.new(
                       :directory => self,
                       :service   => service
                     )
                   end
end

#filesObject



10
11
12
13
14
15
16
17
# File 'lib/fog/atmos/models/storage/directory.rb', line 10

def files
  @files ||= begin
               Fog::Storage::Atmos::Files.new(
                 :directory => self,
                 :service   => service
               )
             end
end

#saveObject



28
29
30
31
32
33
# File 'lib/fog/atmos/models/storage/directory.rb', line 28

def save
  self.key = attributes[:directory].key + key if attributes[:directory]
  self.key = key + '/' unless key =~ /\/$/
  res = service.post_namespace key
  reload
end