Class: Smith::Workflow::Graph::RuntimeReadinessReport
- Inherits:
-
Object
- Object
- Smith::Workflow::Graph::RuntimeReadinessReport
- Extended by:
- Dry::Initializer
- Defined in:
- lib/smith/workflow/graph/runtime_readiness_report.rb
Instance Method Summary collapse
- #diagnostics ⇒ Object
- #errors ⇒ Object
- #ready? ⇒ Boolean (also: #valid?)
- #status ⇒ Object
- #suggestions ⇒ Object
- #to_h ⇒ Object
- #topology_status ⇒ Object
- #warnings ⇒ Object
Instance Method Details
#diagnostics ⇒ Object
32 33 34 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 32 def diagnostics topology_report.diagnostics + runtime_diagnostics end |
#errors ⇒ Object
36 37 38 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 36 def errors diagnostics.select { |diagnostic| diagnostic.severity == :error } end |
#ready? ⇒ Boolean Also known as: valid?
16 17 18 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 16 def ready? errors.empty? end |
#status ⇒ Object
21 22 23 24 25 26 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 21 def status return :not_ready if errors.any? return :warning if warnings.any? :ready end |
#suggestions ⇒ Object
44 45 46 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 44 def suggestions diagnostics.map(&:suggestion).compact.uniq end |
#to_h ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 48 def to_h { status: status, workflow_class: workflow_class, topology_status: topology_status, ready: ready?, diagnostics: diagnostics.map(&:to_h), runtime_diagnostics: runtime_diagnostics.map(&:to_h), topology_diagnostics: topology_report.diagnostics.map(&:to_h), suggestions: suggestions, metrics: metrics, graph: topology_report.to_h } end |
#topology_status ⇒ Object
28 29 30 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 28 def topology_status topology_report.status end |
#warnings ⇒ Object
40 41 42 |
# File 'lib/smith/workflow/graph/runtime_readiness_report.rb', line 40 def warnings diagnostics.select { |diagnostic| diagnostic.severity == :warning } end |