Method: InspecTools::XCCDF#to_attributes

Defined in:
lib/inspec_tools/xccdf.rb

#to_attributesObject

extracts non-InSpec attributes

TODO there may be more attributes we want to extract, see data/attributes.yml for example



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/inspec_tools/xccdf.rb', line 46

def to_attributes # rubocop:disable Metrics/AbcSize
  @attribute = {}

  @attribute['benchmark.title'] = @benchmark.title
  @attribute['benchmark.id'] = @benchmark.id
  @attribute['benchmark.description'] = @benchmark.description
  @attribute['benchmark.version'] = @benchmark.version

  @attribute['benchmark.status'] = @benchmark.status
  @attribute['benchmark.status.date'] = @benchmark.release_date.release_date

  @attribute['benchmark.notice.id'] = @benchmark.notice.id

  @attribute['benchmark.plaintext'] = @benchmark.plaintext.plaintext
  @attribute['benchmark.plaintext.id'] = @benchmark.plaintext.id

  @attribute['reference.href'] = @benchmark.reference.href
  @attribute['reference.dc.publisher'] = @benchmark.reference.dc_publisher
  @attribute['reference.dc.source'] = @benchmark.reference.dc_source
  @attribute['reference.dc.title'] = @benchmark.group[0].rule.reference.dc_title if !@benchmark.group[0].nil?
  @attribute['reference.dc.subject'] = @benchmark.group[0].rule.reference.dc_subject if !@benchmark.group[0].nil?
  @attribute['reference.dc.type'] = @benchmark.group[0].rule.reference.dc_type if !@benchmark.group[0].nil?
  @attribute['reference.dc.identifier'] = @benchmark.group[0].rule.reference.dc_identifier if !@benchmark.group[0].nil?

  @attribute['content_ref.name'] = @benchmark.group[0].rule.check.content_ref.name if !@benchmark.group[0].nil?
  @attribute['content_ref.href'] = @benchmark.group[0].rule.check.content_ref.href if !@benchmark.group[0].nil?

  @attribute
end