Class: Fog::Local::Storage::Mock

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mock

Returns a new instance of Mock.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/storage/local.rb', line 22

def initialize(options={})
  Fog::Mock.not_implemented

  require 'mime/types'
  unless options.delete(:provider)
    location = caller.first
    warning = "[yellow][WARN] Fog::Local::Storage.new is deprecated, use Fog::Storage.new(:provider => 'Local') instead[/]"
    warning << " [light_black](" << location << ")[/] "
    Formatador.display_line(warning)
  end

  @local_root = ::File.expand_path(options[:local_root])
  reset_data
end

Class Method Details

.dataObject



16
17
18
19
20
# File 'lib/fog/storage/local.rb', line 16

def self.data
  @data ||= Hash.new do |hash, key|
    hash[key] = {}
  end
end

Instance Method Details

#local_rootObject



37
38
39
# File 'lib/fog/storage/local.rb', line 37

def local_root
  @local_root
end

#path_to(partial) ⇒ Object



41
42
43
# File 'lib/fog/storage/local.rb', line 41

def path_to(partial)
  ::File.join(@local_root, partial)
end

#reset_dataObject



45
46
47
48
# File 'lib/fog/storage/local.rb', line 45

def reset_data
  self.class.data.delete(@local_root)
  @data = self.class.data[@local_root]
end