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.



10
11
12
13
14
15
# File 'lib/inspec/runtime_profile.rb', line 10

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.



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

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



21
22
23
24
# File 'lib/inspec/runtime_profile.rb', line 21

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