Class: Smith::Workflow::Graph

Inherits:
Object
  • Object
show all
Defined in:
lib/smith/workflow/graph.rb,
lib/smith/workflow/graph/report.rb,
lib/smith/workflow/graph/metrics.rb,
lib/smith/workflow/graph/targets.rb,
lib/smith/workflow/graph/reference.rb,
lib/smith/workflow/graph/validator.rb,
lib/smith/workflow/graph/diagnostic.rb,
lib/smith/workflow/graph/reachability.rb,
lib/smith/workflow/graph/fanout_contract.rb,
lib/smith/workflow/graph/contract_helpers.rb,
lib/smith/workflow/graph/runtime_readiness.rb,
lib/smith/workflow/graph/state_diagnostics.rb,
lib/smith/workflow/graph/transition_snapshot.rb,
lib/smith/workflow/graph/optimization_contract.rb,
lib/smith/workflow/graph/orchestration_contract.rb,
lib/smith/workflow/graph/transition_diagnostics.rb,
lib/smith/workflow/graph/reachability_diagnostics.rb,
lib/smith/workflow/graph/runtime_readiness_report.rb,
lib/smith/workflow/graph/runtime_readiness_metrics.rb,
lib/smith/workflow/graph/runtime_binding_diagnostics.rb,
lib/smith/workflow/graph/nested_readiness_diagnostics.rb,
lib/smith/workflow/graph/runtime_binding_diagnostic_builder.rb

Defined Under Namespace

Modules: ContractHelpers, Reference Classes: Diagnostic, FanoutContract, Metrics, NestedReadinessDiagnostics, OptimizationContract, OrchestrationContract, Reachability, ReachabilityDiagnostics, Report, RuntimeBindingDiagnosticBuilder, RuntimeBindingDiagnostics, RuntimeReadiness, RuntimeReadinessMetrics, RuntimeReadinessReport, StateDiagnostics, Targets, TransitionDiagnostics, TransitionSnapshot, Validator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow_class:, initial_state:, states:, transitions:) ⇒ Graph

Returns a new instance of Graph.



8
9
10
11
12
13
# File 'lib/smith/workflow/graph.rb', line 8

def initialize(workflow_class:, initial_state:, states:, transitions:)
  @workflow_class = workflow_class
  @initial_state = initial_state
  @states = Array(states).uniq.freeze
  @transitions = transitions.dup.freeze
end

Instance Attribute Details

#initial_stateObject (readonly)

Returns the value of attribute initial_state.



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

def initial_state
  @initial_state
end

#statesObject (readonly)

Returns the value of attribute states.



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

def states
  @states
end

#transitionsObject (readonly)

Returns the value of attribute transitions.



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

def transitions
  @transitions
end

#workflow_classObject (readonly)

Returns the value of attribute workflow_class.



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

def workflow_class
  @workflow_class
end

Instance Method Details

#runtime_readiness(visited: nil) ⇒ Object



19
20
21
# File 'lib/smith/workflow/graph.rb', line 19

def runtime_readiness(visited: nil)
  RuntimeReadiness.new(self, visited: visited).report
end

#transition_snapshotsObject



23
24
25
26
27
# File 'lib/smith/workflow/graph.rb', line 23

def transition_snapshots
  transitions.values.map do |transition|
    TransitionSnapshot.from_transition(transition, workflow_class: workflow_class)
  end
end

#validateObject



15
16
17
# File 'lib/smith/workflow/graph.rb', line 15

def validate
  Validator.new(self).report
end