Class: Inspec::RuntimeProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/runtime_profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile) ⇒ RuntimeProfile

Returns a new instance of RuntimeProfile.



7
8
9
10
11
12
# File 'lib/inspec/runtime_profile.rb', line 7

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

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



5
6
7
# File 'lib/inspec/runtime_profile.rb', line 5

def files
  @files
end

Instance Method Details

#file(name) ⇒ String

Retrieve a profile file’s contents

Parameters:

  • name (String)

    the name of the file

Returns:

  • (String)

    contents of the file of RuntimeError if missing



18
19
20
21
# File 'lib/inspec/runtime_profile.rb', line 18

def file(name)
  @src.data_files[File.join("files", name)] ||
    raise("Cannot find file #{name} in profile.")
end