Sha256: a960649dd31a4731b985a9c16a29f4a38005c87f3b5665111cc1fdda4ad82d93

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

require "erb"

module Tinydot
  class Digraph
    def initialize(name)
      @name = name
      @nodes = []
    end

    def to_dot
      template_path = Tinydot.root_path.join("lib/tinydot/template.dot.erb")
      template = ERB.new(template_path.read, nil, "-")
      template.result(binding)
    end

    def method_missing(name, *args)
      node = @nodes.select { |node| node.name == name }.first
      if node.nil?
        node = Node.new(name)
        @nodes << node
      end
      node
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tinydot-0.0.1 lib/tinydot/digraph.rb