Class: Smith::Workflow::Graph::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/smith/workflow/graph/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ Validator

Returns a new instance of Validator.



9
10
11
# File 'lib/smith/workflow/graph/validator.rb', line 9

def initialize(graph)
  @graph = graph
end

Instance Attribute Details

#graphObject (readonly)

Returns the value of attribute graph.



7
8
9
# File 'lib/smith/workflow/graph/validator.rb', line 7

def graph
  @graph
end

Instance Method Details

#reportObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/smith/workflow/graph/validator.rb', line 13

def report
  diagnostics = all_diagnostics

  Report.new(
    status: status_for(diagnostics),
    workflow_class: graph.workflow_class.name,
    initial_state: graph.initial_state,
    states: graph.states,
    transitions: graph.transition_snapshots,
    diagnostics: diagnostics,
    metrics: Metrics.new(graph, reachable_transition_names).to_h
  )
end