Class: Inspec::Fetcher::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/fetcher/mock.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Mock

Returns a new instance of Mock.



16
17
18
# File 'lib/inspec/fetcher/mock.rb', line 16

def initialize(data)
  @data = data
end

Class Method Details

.resolve(target) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/inspec/fetcher/mock.rb', line 8

def self.resolve(target)
  if (target.is_a? Hash) && ((target.keys & %i{cwd path backend}).empty?)
    new(target)
  else
    nil
  end
end

Instance Method Details

#archive_pathObject



24
25
26
# File 'lib/inspec/fetcher/mock.rb', line 24

def archive_path
  { mock: @data }
end

#cache_keyObject



32
33
34
# File 'lib/inspec/fetcher/mock.rb', line 32

def cache_key
  ""
end

#fetch(_path) ⇒ Object



20
21
22
# File 'lib/inspec/fetcher/mock.rb', line 20

def fetch(_path)
  archive_path
end

#resolved_sourceObject



28
29
30
# File 'lib/inspec/fetcher/mock.rb', line 28

def resolved_source
  { mock_fetcher: true }
end