Class: BenchmarkResult

Inherits:
Object
  • Object
show all
Defined in:
lib/audit/lib/benchmark/benchmark_result.rb

Overview

To change this template, choose Tools | Templates and open the template in the editor.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(audit) ⇒ BenchmarkResult

Returns a new instance of BenchmarkResult.



7
8
9
10
# File 'lib/audit/lib/benchmark/benchmark_result.rb', line 7

def initialize(audit)
  @audit = audit
  @document = {}
end

Instance Attribute Details

#auditObject (readonly)

Returns the value of attribute audit.



5
6
7
# File 'lib/audit/lib/benchmark/benchmark_result.rb', line 5

def audit
  @audit
end

Instance Method Details

#add(rule_result) ⇒ Object



12
13
14
# File 'lib/audit/lib/benchmark/benchmark_result.rb', line 12

def add(rule_result)
  @document[rule_result.rule.id] = rule_result
end

#get(id) ⇒ Object



16
17
18
19
20
# File 'lib/audit/lib/benchmark/benchmark_result.rb', line 16

def get(id)
  return @benchmark if id == :root || id == 'BENCHMARK'
  
  return @document[id] || @benchmark.get_item(id)
end

#get_rootObject



22
23
24
# File 'lib/audit/lib/benchmark/benchmark_result.rb', line 22

def get_root()
  return get(:root)
end