Sha256: b1583a5e258cf7817d353b85d4289066e5f29d5a61f577bf311bba851d9f8b02

Contents?: true

Size: 881 Bytes

Versions: 74

Compression:

Stored size: 881 Bytes

Contents

# 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

Version data entries

74 entries across 74 versions & 4 rubygems

Version Path
actionpack-4.1.16 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.16.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.15 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.15.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.14.2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.14.1 lib/action_dispatch/journey/nfa/dot.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/actionpack-4.1.13/lib/action_dispatch/journey/nfa/dot.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/actionpack-4.1.13/lib/action_dispatch/journey/nfa/dot.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/actionpack-4.1.13/lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.14 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.14.rc2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.14.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.13 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.13.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.12 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.12.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.11 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.10 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.10.rc4 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.1.10.rc3 lib/action_dispatch/journey/nfa/dot.rb