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/state_diagnostics.rb,
lib/smith/workflow/graph/transition_snapshot.rb,
lib/smith/workflow/graph/transition_diagnostics.rb,
lib/smith/workflow/graph/reachability_diagnostics.rb

Defined Under Namespace

Modules: Reference Classes: Diagnostic, Metrics, Reachability, ReachabilityDiagnostics, Report, 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

#transition_snapshotsObject



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

def transition_snapshots
  transitions.values.map { |transition| TransitionSnapshot.from_transition(transition) }
end

#validateObject



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

def validate
  Validator.new(self).report
end