Class: RuleResult
- Inherits:
-
Object
- Object
- RuleResult
- Defined in:
- lib/audit/lib/benchmark/rule_result.rb
Instance Attribute Summary collapse
-
#check ⇒ Object
readonly
Returns the value of attribute check.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#rule_idref ⇒ Object
readonly
Returns the value of attribute rule_idref.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(rule, results) ⇒ RuleResult
constructor
A new instance of RuleResult.
- #to_hash ⇒ Object
Constructor Details
#initialize(rule, results) ⇒ RuleResult
Returns a new instance of RuleResult.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 13 def initialize(rule, results) @timestamp = Time.now.utc # @severity = rule.severity # @version = rule.version return_codes = results.reject {|x| x.type != ResultType::CHECK_FINISHED} raise "Each rule should have exacty one return code" if return_codes.length != 1 return_code = return_codes[0] if return_code.exit_code.downcase == "pass" then @result = ResultCode::PASS else @result = ResultCode::FAIL end @rule_idref = rule.id @rule = rule @check = results end |
Instance Attribute Details
#check ⇒ Object (readonly)
Returns the value of attribute check.
6 7 8 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 6 def check @check end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 8 def result @result end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
5 6 7 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 5 def rule @rule end |
#rule_idref ⇒ Object (readonly)
Returns the value of attribute rule_idref.
7 8 9 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 7 def rule_idref @rule_idref end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
11 12 13 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 11 def severity @severity end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
10 11 12 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 10 def @timestamp end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/audit/lib/benchmark/rule_result.rb', line 9 def version @version end |