Class: Utils::XCCDFScore
Overview
Perform scoring calculations for the different types that is used in a TestResult score.
Instance Method Summary collapse
-
#absolute_score ⇒ Object
urn:xccdf:scoring:absolute.
-
#default_score ⇒ Object
Calculate and return the urn:xccdf:scoring:default score for the entire benchmark.
-
#flat_score ⇒ Object
urn:xccdf:scoring:flat.
-
#flat_unweighted_score ⇒ Object
urn:xccdf:scoring:flat-unweighted.
-
#initialize(groups, rule_results) ⇒ XCCDFScore
constructor
A new instance of XCCDFScore.
Constructor Details
#initialize(groups, rule_results) ⇒ XCCDFScore
Returns a new instance of XCCDFScore.
6 7 8 9 |
# File 'lib/utilities/xccdf/xccdf_score.rb', line 6 def initialize(groups, rule_results) @groups = groups @rule_results = rule_results end |
Instance Method Details
#absolute_score ⇒ Object
urn:xccdf:scoring:absolute
33 34 35 36 |
# File 'lib/utilities/xccdf/xccdf_score.rb', line 33 def absolute_score results = score_benchmark_with_weights(true) HappyMapperTools::Benchmark::ScoreType.new('urn:xccdf:scoring:absolute', 1, (results[:max] == results[:score] && results[:max].positive? ? 1 : 0)) end |
#default_score ⇒ Object
Calculate and return the urn:xccdf:scoring:default score for the entire benchmark.
13 14 15 |
# File 'lib/utilities/xccdf/xccdf_score.rb', line 13 def default_score HappyMapperTools::Benchmark::ScoreType.new('urn:xccdf:scoring:default', 100, score_benchmark_default) end |
#flat_score ⇒ Object
urn:xccdf:scoring:flat
19 20 21 22 |
# File 'lib/utilities/xccdf/xccdf_score.rb', line 19 def flat_score results = score_benchmark_with_weights(true) HappyMapperTools::Benchmark::ScoreType.new('urn:xccdf:scoring:flat', results[:max], results[:score]) end |
#flat_unweighted_score ⇒ Object
urn:xccdf:scoring:flat-unweighted
26 27 28 29 |
# File 'lib/utilities/xccdf/xccdf_score.rb', line 26 def flat_unweighted_score results = score_benchmark_with_weights(false) HappyMapperTools::Benchmark::ScoreType.new('urn:xccdf:scoring:flat-unweighted', results[:max], results[:score]) end |