Class: Inspec::DirProvider
Instance Attribute Summary collapse
Instance Method Summary
collapse
for_path, #relative_provider
Constructor Details
70
71
72
73
74
75
76
77
|
# File 'lib/inspec/file_provider.rb', line 70
def initialize(path)
@files = if File.file?(path)
[path]
else
Dir[File.join(Shellwords.shellescape(path), "**", "*")]
end
@path = path
end
|
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
69
70
71
|
# File 'lib/inspec/file_provider.rb', line 69
def files
@files
end
|
Instance Method Details
#binread(file) ⇒ Object
86
87
88
89
90
91
|
# File 'lib/inspec/file_provider.rb', line 86
def binread(file)
return nil unless files.include?(file)
return nil unless File.file?(file)
File.binread(file)
end
|
#read(file) ⇒ Object
79
80
81
82
83
84
|
# File 'lib/inspec/file_provider.rb', line 79
def read(file)
return nil unless files.include?(file)
return nil unless File.file?(file)
File.read(file)
end
|