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

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mock

Returns a new instance of Mock.



27
28
29
30
# File 'lib/fog/local/storage.rb', line 27

def initialize(options={})
  @local_root = ::File.expand_path(options[:local_root])
  @data       = self.class.data[@local_root]
end

Class Method Details

.dataObject



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

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

.reset_data(keys = data.keys) ⇒ Object



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

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

Instance Method Details

#local_rootObject



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

def local_root
  @local_root
end

#path_to(partial) ⇒ Object



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

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