Class: Fog::Local::Directory

Inherits:
Model
  • Object
show all
Extended by:
Deprecation
Defined in:
lib/fog/local/models/directory.rb

Instance Attribute Summary

Attributes inherited from Model

#connection

Instance Method Summary collapse

Methods included from Deprecation

deprecate

Methods inherited from Model

#collection, #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, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/local/models/directory.rb', line 14

def destroy
  requires :key

  if ::File.directory?(path)
    Dir.rmdir(path)
    true
  else
    false
  end
end

#filesObject



25
26
27
28
29
30
31
32
# File 'lib/fog/local/models/directory.rb', line 25

def files
  @files ||= begin
    Fog::Local::Files.new(
      :directory    => self,
      :connection   => connection
    )
  end
end

#saveObject



34
35
36
37
38
39
# File 'lib/fog/local/models/directory.rb', line 34

def save
  requires :key

  Dir.mkdir(path)
  true
end