Class: Inspec::RunData::Control

Inherits:
Struct
  • Object
show all
Includes:
HashLikeStruct
Defined in:
lib/inspec/run_data/control.rb,
lib/inspec/run_data/control.rb

Defined Under Namespace

Classes: Ref, SourceLocation, WaiverData

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashLikeStruct

#key?, #keys, #non_nil?

Constructor Details

#initialize(raw_ctl_data) ⇒ Control

Returns a new instance of Control.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/inspec/run_data/control.rb', line 17

def initialize(raw_ctl_data)
  self.refs = (raw_ctl_data[:refs] || []).map { |r| Inspec::RunData::Control::Ref.new(r) }
  self.results = (raw_ctl_data[:results] || []).map { |r| Inspec::RunData::Result.new(r) }
  self.source_location = Inspec::RunData::Control::SourceLocation.new(raw_ctl_data[:source_location] || {})
  self.waiver_data = Inspec::RunData::Control::WaiverData.new(raw_ctl_data[:waiver_data] || {})

  [
    :code,            # String
    :desc,            # String
    :descriptions,    # Hash with custom keys
    :id,              # String
    :impact,          # Float
    :tags,            # Hash with custom keys
    :title,           # String
  ].each do |field|
    self[field] = raw_ctl_data[field]
  end
end

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def code
  @code
end

#descObject

Returns the value of attribute desc

Returns:

  • (Object)

    the current value of desc



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def desc
  @desc
end

#descriptionsObject

Returns the value of attribute descriptions

Returns:

  • (Object)

    the current value of descriptions



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def descriptions
  @descriptions
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def id
  @id
end

#impactObject

Returns the value of attribute impact

Returns:

  • (Object)

    the current value of impact



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def impact
  @impact
end

#refsObject

Returns the value of attribute refs

Returns:

  • (Object)

    the current value of refs



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def refs
  @refs
end

#resultsObject

Returns the value of attribute results

Returns:

  • (Object)

    the current value of results



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def results
  @results
end

#source_locationObject

Returns the value of attribute source_location

Returns:

  • (Object)

    the current value of source_location



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def source_location
  @source_location
end

#tagsObject

Returns the value of attribute tags

Returns:

  • (Object)

    the current value of tags



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def tags
  @tags
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def title
  @title
end

#waiver_dataObject

Returns the value of attribute waiver_data

Returns:

  • (Object)

    the current value of waiver_data



3
4
5
# File 'lib/inspec/run_data/control.rb', line 3

def waiver_data
  @waiver_data
end