Class: ProtoProcessor::Report
- Inherits:
-
Object
- Object
- ProtoProcessor::Report
- Includes:
- Enumerable
- Defined in:
- lib/proto_processor/report.rb
Instance Attribute Summary collapse
-
#chain_outputs ⇒ Object
readonly
Returns the value of attribute chain_outputs.
-
#chain_statuses ⇒ Object
readonly
Returns the value of attribute chain_statuses.
-
#chain_tasks ⇒ Object
readonly
Returns the value of attribute chain_tasks.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #[](chain_key) ⇒ Object
- #each(&block) ⇒ Object
-
#fail!(exception) ⇒ Object
Major fail at strategy level.
-
#initialize ⇒ Report
constructor
A new instance of Report.
-
#report(chain_key, tasks, output) ⇒ Object
Store tasks and output after running task chain.
- #run_report ⇒ Object
- #successful? ⇒ Boolean
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
7 8 9 10 11 12 13 |
# File 'lib/proto_processor/report.rb', line 7 def initialize @chain_outputs = {} @chain_tasks = {} @chain_statuses = [] @error = nil end |
Instance Attribute Details
#chain_outputs ⇒ Object (readonly)
Returns the value of attribute chain_outputs.
5 6 7 |
# File 'lib/proto_processor/report.rb', line 5 def chain_outputs @chain_outputs end |
#chain_statuses ⇒ Object (readonly)
Returns the value of attribute chain_statuses.
5 6 7 |
# File 'lib/proto_processor/report.rb', line 5 def chain_statuses @chain_statuses end |
#chain_tasks ⇒ Object (readonly)
Returns the value of attribute chain_tasks.
5 6 7 |
# File 'lib/proto_processor/report.rb', line 5 def chain_tasks @chain_tasks end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/proto_processor/report.rb', line 5 def error @error end |
Instance Method Details
#[](chain_key) ⇒ Object
26 27 28 |
# File 'lib/proto_processor/report.rb', line 26 def [](chain_key) @chain_outputs[chain_key] end |
#each(&block) ⇒ Object
22 23 24 |
# File 'lib/proto_processor/report.rb', line 22 def each(&block) @chain_outputs.each &block end |
#fail!(exception) ⇒ Object
Major fail at strategy level
32 33 34 |
# File 'lib/proto_processor/report.rb', line 32 def fail!(exception) @error = exception end |
#report(chain_key, tasks, output) ⇒ Object
Store tasks and output after running task chain
17 18 19 20 |
# File 'lib/proto_processor/report.rb', line 17 def report(chain_key, tasks, output) report_output(chain_key, output) report_tasks(chain_key, tasks) end |
#run_report ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/proto_processor/report.rb', line 40 def run_report @run_report ||= begin rep = {} @chain_tasks.each do |task_name, runs| runs.each_with_index do |r, i| rep[:"#{task_name}_#{i}"] = r.map{|t| "#{t.class.name}: #{t.report[:status]}"} end end rep end end |
#successful? ⇒ Boolean
36 37 38 |
# File 'lib/proto_processor/report.rb', line 36 def successful? @error.nil? end |