Class: Fog::Local::Directory

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

Instance Attribute Summary

Attributes inherited from Model

#connection

Instance Method Summary collapse

Methods inherited from Model

#_dump, _load, aliases, attribute, attributes, #attributes, #collection, identity, #identity, #initialize, #inspect, #merge_attributes, #new_record?, #reload, #requires, #to_json, #wait_for

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/local/models/directory.rb', line 11

def destroy
  requires :name

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

#filesObject



22
23
24
25
26
27
28
29
# File 'lib/fog/local/models/directory.rb', line 22

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

#saveObject



31
32
33
34
35
36
# File 'lib/fog/local/models/directory.rb', line 31

def save
  requires :name

  Dir.mkdir(path)
  true
end