Sha256: 6f9f9f37e65cdce42be0ed0aa866cec6854b5ec3fc0460de74de5f7b4427d14b

Contents?: true

Size: 783 Bytes

Versions: 104

Compression:

Stored size: 783 Bytes

Contents

# encoding: utf-8

module Journey
  module NFA
    module Dot
      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

Version data entries

104 entries across 78 versions & 19 rubygems

Version Path
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/journey-1.0.4/lib/journey/nfa/dot.rb
swipe-rails-0.0.5 vendor/bundle/gems/journey-1.0.4/lib/journey/nfa/dot.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/journey-1.0.4/lib/journey/nfa/dot.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/journey-1.0.4/lib/journey/nfa/dot.rb
challah-1.0.0.beta3 vendor/bundle/gems/journey-1.0.4/lib/journey/nfa/dot.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
challah-1.0.0.beta2 vendor/bundle/gems/journey-1.0.4/lib/journey/nfa/dot.rb
challah-1.0.0.beta vendor/bundle/gems/journey-1.0.4/lib/journey/nfa/dot.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb
active_mailer-0.0.4 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/nfa/dot.rb