Class: Fog::Storage::Local::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.



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

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

  require 'mime/types'
  @local_root = ::File.expand_path(options[:local_root])
end

Class Method Details

.dataObject



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

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

.resetObject



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

def self.reset
  @data = nil
end

Instance Method Details

#dataObject



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

def data
  self.class.data[@local_root]
end

#local_rootObject



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

def local_root
  @local_root
end

#path_to(partial) ⇒ Object



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

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

#reset_dataObject



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

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