Sha256: 5bb70665d80ab2c8531fc72cdd483923068339b20264d3f54fdeba7875439d98

Contents?: true

Size: 878 Bytes

Versions: 52

Compression:

Stored size: 878 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.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

52 entries across 51 versions & 8 rubygems

Version Path
actionpack-4.2.11.3 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.11.2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.11.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.11 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.10 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.10.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.9 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.9.rc2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.9.rc1 lib/action_dispatch/journey/nfa/dot.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/actionpack-4.2.8/lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.8 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.8.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.7.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.7 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.7.rc1 lib/action_dispatch/journey/nfa/dot.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.6 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.6.rc1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-4.2.5.2 lib/action_dispatch/journey/nfa/dot.rb
activejob-lock-0.0.2 rails/actionpack/lib/action_dispatch/journey/nfa/dot.rb