Sha256: be2285dcca9d4e1c6fa75c883db8265f6399c3badebfb021c6edefa2de477b5d

Contents?: true

Size: 863 Bytes

Versions: 20

Compression:

Stored size: 863 Bytes

Contents

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.flat_map { |k, memos|
          #  (memos || []).map { |v| "  #{k} -> #{v.object_id};" }
          #}.uniq

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
actionpack-5.1.7 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.7.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.6.2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.6.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.6 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.5 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.5.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.4 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.4.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.3 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.3.rc3 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.3.rc2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.3.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.2.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.0 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.0.rc2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.0.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.1.0.beta1 lib/action_dispatch/journey/nfa/dot.rb