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

Version Path
aws_security_viz-0.1.3.pre.alpha.pre.70 lib/renderer/json.rb
aws_security_viz-0.1.3.pre.alpha.pre.69 lib/renderer/json.rb
aws_security_viz-0.1.3.pre.alpha.pre.68 lib/renderer/json.rb
aws_security_viz-0.1.3.pre.alpha.pre.64 lib/renderer/json.rb
aws_security_viz-0.1.3.pre.alpha.pre.63 lib/renderer/json.rb
aws_security_viz-0.1.2 lib/renderer/json.rb
aws_security_viz-0.1.2.pre.alpha.pre.61 lib/renderer/json.rb
aws_security_viz-0.1.2.pre.alpha.pre.60 lib/renderer/json.rb
aws_security_viz-0.1.2.pre.alpha.pre.59 lib/renderer/json.rb