Class: Inspec::FileProvider
- Inherits:
-
Object
- Object
- Inspec::FileProvider
show all
- Defined in:
- lib/inspec/file_provider.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FileProvider.
24
25
|
# File 'lib/inspec/file_provider.rb', line 24
def initialize(_path)
end
|
Class Method Details
.for_path(path) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/inspec/file_provider.rb', line 8
def self.for_path(path)
if path.is_a?(Hash)
MockProvider.new(path)
elsif File.directory?(path)
DirProvider.new(path)
elsif File.exist?(path) && path.end_with?('.tar.gz', 'tgz')
TarProvider.new(path)
elsif File.exist?(path) && path.end_with?('.zip')
ZipProvider.new(path)
elsif File.exist?(path)
DirProvider.new(path)
else
raise "No file provider for the provided path: #{path}"
end
end
|
Instance Method Details
#files ⇒ Object
31
32
33
|
# File 'lib/inspec/file_provider.rb', line 31
def files
raise "Fetcher #{self} does not implement `files()`. This is required."
end
|
#read(_file) ⇒ Object
27
28
29
|
# File 'lib/inspec/file_provider.rb', line 27
def read(_file)
raise "#{self} does not implement `read(...)`. This is required."
end
|
#relative_provider ⇒ Object