Class: OpenscapParser::TestResult

Inherits:
XmlNode
  • Object
show all
Includes:
RuleResults, Selectors
Defined in:
lib/openscap_parser/test_result.rb

Instance Attribute Summary

Attributes inherited from XmlNode

#namespaces

Instance Method Summary collapse

Methods included from SetValues

included

Methods included from RuleResults

included

Methods inherited from XmlNode

#initialize, #parsed_xml, #text, #xpath_node, #xpath_nodes

Constructor Details

This class inherits a constructor from OpenscapParser::XmlNode

Instance Method Details

#benchmark_idObject



40
41
42
43
# File 'lib/openscap_parser/test_result.rb', line 40

def benchmark_id
  @benchmark_id ||= parsed_xml.at_xpath('benchmark') &&
    parsed_xml.at_xpath('benchmark')['id'] || ''
end

#end_timeObject



58
59
60
# File 'lib/openscap_parser/test_result.rb', line 58

def end_time
  @end_time ||= DateTime.parse(parsed_xml['end-time'])
end

#identityObject



30
31
32
33
# File 'lib/openscap_parser/test_result.rb', line 30

def identity
  @identity ||= parsed_xml.at_xpath('identity') &&
    parsed_xml.at_xpath('identity').text || ''
end

#platform_nodesObject



21
22
23
# File 'lib/openscap_parser/test_result.rb', line 21

def platform_nodes
  @platform_nodes ||= parsed_xml.xpath('platform')
end

#profile_idObject



35
36
37
38
# File 'lib/openscap_parser/test_result.rb', line 35

def profile_id
  @profile_id ||= parsed_xml.at_xpath('profile') &&
    parsed_xml.at_xpath('profile')['idref'] || ''
end

#scoreObject



49
50
51
52
# File 'lib/openscap_parser/test_result.rb', line 49

def score
  @score ||= parsed_xml.at_xpath('score') &&
    parsed_xml.at_xpath('score').text.to_f
end

#set_value_nodesObject



45
46
47
# File 'lib/openscap_parser/test_result.rb', line 45

def set_value_nodes
  @set_value_nodes ||= parsed_xml.xpath('set-value')
end

#start_timeObject



54
55
56
# File 'lib/openscap_parser/test_result.rb', line 54

def start_time
  @start_time ||= DateTime.parse(parsed_xml['start-time'])
end

#targetObject Also known as: host



11
12
13
14
# File 'lib/openscap_parser/test_result.rb', line 11

def target
  @target ||= parsed_xml.at_xpath('target') &&
    parsed_xml.at_xpath('target').text || ''
end

#target_fact_nodesObject



17
18
19
# File 'lib/openscap_parser/test_result.rb', line 17

def target_fact_nodes
  @target_fact_nodes ||= parsed_xml.xpath('target-facts/fact')
end

#titleObject



25
26
27
28
# File 'lib/openscap_parser/test_result.rb', line 25

def title
  @title ||= parsed_xml.at_xpath('title') &&
    parsed_xml.at_xpath('title').text || ''
end