Sha256: b4c6774f8231c2c43b9a55ac33348046f96077eb3ecc4fbdf3b4dfa37ae6074f

Contents?: true

Size: 904 Bytes

Versions: 134

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

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

134 entries across 126 versions & 7 rubygems

Version Path
actionpack-6.0.6.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.6 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.5.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.2.8.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.2.8 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.5 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.8 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.2.7.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.2.7 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.7 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.2.6.3 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.6 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.2.6.2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-5.2.6.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.5 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.4 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.3 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.2 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4.1 lib/action_dispatch/journey/nfa/dot.rb
actionpack-6.0.4 lib/action_dispatch/journey/nfa/dot.rb