class Dogviz::SigmaRenderer
Attributes
edges[R]
nodes[R]
Public Class Methods
new(title)
click to toggle source
# File lib/dogviz/sigma_renderer.rb, line 5 def initialize(title) @title = title @nodes = [] @edges = [] end
Public Instance Methods
graph()
click to toggle source
# File lib/dogviz/sigma_renderer.rb, line 11 def graph SigmaGraphHash.new(nodes: nodes, edges: edges) end
render_edge(from, to, options)
click to toggle source
# File lib/dogviz/sigma_renderer.rb, line 25 def render_edge(from, to, options) @edges << { id: "#{from.id}->#{to.id}", label: "#{from.id}->#{to.id}", source: from.id, target: to.id } end
render_node(parent, id, attributes)
click to toggle source
# File lib/dogviz/sigma_renderer.rb, line 15 def render_node(parent, id, attributes) @nodes << {id: id, label: id} @edges << { id: "#{parent.id}->#{id}", type: 'containment', source: parent.id, target: id } unless parent.root? end
render_subgraph(parent, id, attributes)
click to toggle source
# File lib/dogviz/sigma_renderer.rb, line 34 def render_subgraph(parent, id, attributes) @nodes << {id: container_label(id), type: 'container', label: container_label(id)} @edges << { id: "#{container_label parent.id}->#{container_label id}", type: 'containment', source: container_label(parent.id), target: container_label(id) } unless parent.root? end
Private Instance Methods
container_label(id)
click to toggle source
# File lib/dogviz/sigma_renderer.rb, line 46 def container_label(id) id end