Sha256: 53756e3059cf6d436429ea88257cfbdedaa3a91a244ec288c5f5760385e3c3e0
Contents?: true
Size: 464 Bytes
Versions: 49
Compression:
Stored size: 464 Bytes
Contents
module Renderer class Json def initialize(file_name, config) @nodes = [] @edges = [] @file_name = file_name @config = config end def add_node(name) @nodes << {id: name, label: name} end def add_edge(from, to, opts) @edges << {id: "#{from}-#{to}", source: from, target: to, label: opts[:label]} end def output IO.write(@file_name, {nodes: @nodes, edges: @edges}.to_json) end end end
Version data entries
49 entries across 49 versions & 1 rubygems