Class: ComplianceEngine::EnvironmentLoader::ZipBytes
- Inherits:
-
ComplianceEngine::EnvironmentLoader
- Object
- ComplianceEngine::EnvironmentLoader
- ComplianceEngine::EnvironmentLoader::ZipBytes
- Defined in:
- lib/compliance_engine/environment_loader/zip_bytes.rb
Overview
Load compliance engine data from a raw zip byte string containing a Puppet environment
Instance Attribute Summary
Attributes inherited from ComplianceEngine::EnvironmentLoader
#modulepath, #modules, #zipfile_path
Instance Method Summary collapse
-
#initialize(bytes, root: '/'.dup, load_dotfiles: true, name: nil) ⇒ ZipBytes
constructor
A new instance of ZipBytes.
Constructor Details
#initialize(bytes, root: '/'.dup, load_dotfiles: true, name: nil) ⇒ ZipBytes
Returns a new instance of ZipBytes.
18 19 20 21 22 23 24 25 26 |
# File 'lib/compliance_engine/environment_loader/zip_bytes.rb', line 18 def initialize(bytes, root: '/'.dup, load_dotfiles: true, name: nil) raise ArgumentError, "bytes must be a String, got #{bytes.class}" unless bytes.is_a?(String) zipfile = ::Zip::File.open_buffer(bytes) @modulepath = name || '-' super(root, fileclass: zipfile.file, dirclass: zipfile.dir, zipfile_path: @modulepath, load_dotfiles: load_dotfiles) ensure zipfile&.close end |