Module: ActionDispatch::Journey::NFA::Dot

Included in:
GTG::TransitionTable
Defined in:
actionpack/lib/action_dispatch/journey/nfa/dot.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#to_dotObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'actionpack/lib/action_dispatch/journey/nfa/dot.rb', line 9

def to_dot
  edges = transitions.map { |from, sym, to|
    "  #{from} -> #{to} [label=\"#{sym || 'ε'}\"];"
  }

  "digraph nfa {\n  rankdir=LR;\n  node [shape = doublecircle];\n  \#{accepting_states.join ' '};\n  node [shape = circle];\n\#{edges.join \"\\n\"}\n}\n  eodot\nend\n"