Sha256: 4b0ea53b1e0c4adfcad3eb69cfc7e272f2a360ae5e3af1bf70d0b40fc8f54c28

Contents?: true

Size: 451 Bytes

Versions: 1

Compression:

Stored size: 451 Bytes

Contents

module EndState
  class Graph < GraphViz
    attr_reader :machine, :nodes

    def initialize(machine)
      @machine = machine
      @nodes = {}
      super machine.name.to_sym
    end

    def draw
      machine.transitions.keys.each do |t|
        left, right = t.to_a.flatten
        nodes[left] ||= add_node(left.to_s)
        nodes[right] ||= add_node(right.to_s)
        add_edge nodes[left], nodes[right]
      end
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
end_state-0.2.0 lib/end_state/graph.rb