Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: a36ae63d07
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (33 sloc) 0.881 kB
# encoding: utf-8
module ActionDispatch
module Journey # :nodoc:
module NFA # :nodoc:
module Dot # :nodoc:
def to_dot
edges = transitions.map { |from, sym, to|
" #{from} -> #{to} [label=\"#{sym || 'ε'}\"];"
}
#memo_nodes = memos.values.flatten.map { |n|
# label = n
# if Journey::Route === n
# label = "#{n.verb.source} #{n.path.spec}"
# end
# " #{n.object_id} [label=\"#{label}\", shape=box];"
#}
#memo_edges = memos.map { |k, memos|
# (memos || []).map { |v| " #{k} -> #{v.object_id};" }
#}.flatten.uniq
<<-eodot
digraph nfa {
rankdir=LR;
node [shape = doublecircle];
#{accepting_states.join ' '};
node [shape = circle];
#{edges.join "\n"}
}
eodot
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.