Class: Fog::Storage::Ninefold::Directory
- Defined in:
- lib/fog/ninefold/models/storage/directory.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
Methods inherited from Model
#initialize, #inspect, #reload, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#destroy(opts = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fog/ninefold/models/storage/directory.rb', line 37 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 connection.delete_namespace key end |
#directories ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/fog/ninefold/models/storage/directory.rb', line 21 def directories @directories ||= begin Fog::Storage::Ninefold::Directories.new( :directory => self, :connection => connection ) end end |
#files ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/fog/ninefold/models/storage/directory.rb', line 12 def files @files ||= begin Fog::Storage::Ninefold::Files.new( :directory => self, :connection => connection ) end end |
#save ⇒ Object
30 31 32 33 34 35 |
# File 'lib/fog/ninefold/models/storage/directory.rb', line 30 def save self.key = attributes[:directory].key + key if attributes[:directory] self.key = key + '/' unless key =~ /\/$/ res = connection.post_namespace key reload end |