Class: Inspec::DirProvider
- Inherits:
-
FileProvider
- Object
- FileProvider
- Inspec::DirProvider
- Defined in:
- lib/inspec/file_provider.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
-
#initialize(path) ⇒ DirProvider
constructor
A new instance of DirProvider.
- #read(file) ⇒ Object
Methods inherited from FileProvider
Constructor Details
#initialize(path) ⇒ DirProvider
Returns a new instance of DirProvider.
54 55 56 57 58 59 60 61 |
# File 'lib/inspec/file_provider.rb', line 54 def initialize(path) @files = if File.file?(path) [path] else Dir[File.join(path, '**', '*')] end @path = path end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
53 54 55 |
# File 'lib/inspec/file_provider.rb', line 53 def files @files end |
Instance Method Details
#read(file) ⇒ Object
63 64 65 66 67 |
# File 'lib/inspec/file_provider.rb', line 63 def read(file) return nil unless files.include?(file) return nil unless File.file?(file) File.read(file) end |