Sha256: 8b6d9851156fc05b87dde7b35520ba6ef932fe42c1a84a6f5020b43882c0caf3
Contents?: true
Size: 570 Bytes
Versions: 1
Compression:
Stored size: 570 Bytes
Contents
require "ruby-graphviz" module VisualizeRuby class Graphviz attr_reader :nodes, :edges def initialize(nodes, edges) @nodes = nodes @edges = edges end def to_graph(type: :digraph, **output) g = GraphViz.new(:G, :type => type) edges.each do |edge| node_a = g.add_node(edge.node_a.name.to_s, shape: edge.node_a.shape) node_b = g.add_node(edge.node_b.name.to_s, shape: edge.node_b.shape) g.add_edges(node_a, node_b, label: edge.name.to_s, dir: edge.dir) end g.output(output) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
visualize_ruby-0.1.0 | lib/visualize_ruby/graphviz.rb |