Class: Inspec::TarProvider
- Inherits:
-
FileProvider
- Object
- FileProvider
- Inspec::TarProvider
- 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) ⇒ TarProvider
constructor
A new instance of TarProvider.
- #read(file) ⇒ Object
Methods inherited from FileProvider
#binread, for_path, #relative_provider
Constructor Details
#initialize(path) ⇒ TarProvider
Returns a new instance of TarProvider.
135 136 137 138 139 140 141 142 |
# File 'lib/inspec/file_provider.rb', line 135 def initialize(path) @path = path @contents = {} @files = [] walk_tar(@path) do |tar| @files = tar.map(&:full_name).find_all { |x| !x.empty? } end end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
133 134 135 |
# File 'lib/inspec/file_provider.rb', line 133 def files @files end |
Instance Method Details
#read(file) ⇒ Object
144 145 146 |
# File 'lib/inspec/file_provider.rb', line 144 def read(file) @contents[file] ||= read_from_tar(file) end |