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.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/storage/local.rb', line 28

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

  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])
  @data       = self.class.data[@local_root]
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

.reset_data(keys = data.keys) ⇒ Object



22
23
24
25
26
# File 'lib/fog/storage/local.rb', line 22

def self.reset_data(keys=data.keys)
  for key in [*keys]
    data.delete(key)
  end
end

Instance Method Details

#local_rootObject



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

def local_root
  @local_root
end

#path_to(partial) ⇒ Object



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

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