Class: Fog::Storage::Local::Directory

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



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

def destroy
  requires :key

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

#filesObject



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

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

#public=(new_public) ⇒ Object



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

def public=(new_public)
  new_public
end

#public_urlObject



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

def public_url
  nil
end

#saveObject



40
41
42
43
44
45
# File 'lib/fog/local/models/storage/directory.rb', line 40

def save
  requires :key

  FileUtils.mkpath(path)
  true
end