Sha256: b6d2ab6f91c6527c26b4c771d8629f613ca3b94e0ccc474ec75a9b3ce7f5a349

Contents?: true

Size: 674 Bytes

Versions: 6

Compression:

Stored size: 674 Bytes

Contents

# encoding: utf-8
# Copyright 2017 Chef Software
# author: Dominik Richter
# author: Christoph Hartmann

module Inspec
  class RuntimeProfile
    attr_reader :files

    def initialize(profile)
      @src = profile.source_reader
      @files = @src.data_files.keys.map do |k|
        k.sub('files' + File::SEPARATOR, '')
      end
    end

    # Retrieve a profile file's contents
    #
    # @param name [String] the name of the file
    # @return [String] contents of the file of RuntimeError if missing
    def file(name)
      @src.data_files[File.join('files', name)] ||
        raise("Cannot find file #{name} in profile.")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inspec-2.1.81 lib/inspec/runtime_profile.rb
inspec-2.1.21 lib/inspec/runtime_profile.rb
inspec-2.1.10 lib/inspec/runtime_profile.rb
inspec-2.0.32 lib/inspec/runtime_profile.rb
inspec-2.0.17 lib/inspec/runtime_profile.rb
inspec-1.51.15 lib/inspec/runtime_profile.rb