Class: MetricFu::Result
- Inherits:
-
Object
- Object
- MetricFu::Result
- Defined in:
- lib/metric_fu/reporting/result.rb
Overview
Result
The Result class is responsible for one thing:
It tracks the results generated by each metric used in this test run.
Instance Method Summary collapse
-
#add(result_type) ⇒ Object
Adds a hash from a passed result, produced by one of the Generator classes to the aggregate result_hash managed by this hash.
-
#as_yaml ⇒ Object
Renders the result of the result_hash into a yaml serialization ready for writing out to a file.
- #per_file_data ⇒ Object
-
#result_hash ⇒ Object
:nodoc:.
Instance Method Details
#add(result_type) ⇒ Object
Adds a hash from a passed result, produced by one of the Generator classes to the aggregate result_hash managed by this hash.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/metric_fu/reporting/result.rb', line 41 def add(result_type) mf_debug "result requested #{result_type}" = (result_type) generator_class = MetricFu::Generator.get_generator(result_type) mf_debug "result class found #{generator_class}" generator = generator_class.new() result_hash.merge!(generator.generate_result) generator.per_file_info(per_file_data) if generator.respond_to?(:per_file_info) end |
#as_yaml ⇒ Object
Renders the result of the result_hash into a yaml serialization ready for writing out to a file.
20 21 22 |
# File 'lib/metric_fu/reporting/result.rb', line 20 def as_yaml result_hash.to_yaml end |
#per_file_data ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/metric_fu/reporting/result.rb', line 24 def per_file_data @per_file_data ||= Hash.new do |hash, filename| hash[filename] = Hash.new do |h, line| h[line] = Array.new end end end |
#result_hash ⇒ Object
:nodoc:
32 33 34 |
# File 'lib/metric_fu/reporting/result.rb', line 32 def result_hash #:nodoc: @result_hash ||= {} end |