Class: Smith::Workflow::Graph::Reachability

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ Reachability

Returns a new instance of Reachability.



9
10
11
# File 'lib/smith/workflow/graph/reachability.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/reachability.rb', line 7

def graph
  @graph
end

Instance Method Details

#each_transitionObject



17
18
19
20
21
22
23
24
# File 'lib/smith/workflow/graph/reachability.rb', line 17

def each_transition
  return enum_for(__method__) unless block_given?

  root = successors.initial_transition
  return unless root

  walk(root) { yield _1 }
end

#transition_namesObject



13
14
15
# File 'lib/smith/workflow/graph/reachability.rb', line 13

def transition_names
  each_transition.map(&:name)
end