module Recursivar::Formats::Graph

Public Instance Methods

each_nodes(&block) click to toggle source
# File lib/recursivar/formats.rb, line 74
def each_nodes(&block)
  block.call(label)
  vars.each do |v|
    v.each_nodes(&block) unless v.ref
  end
end
label() click to toggle source
# File lib/recursivar/formats.rb, line 88
def label
  "#<#{klass}:#{obj.object_id}>"
end
to_s() click to toggle source
# File lib/recursivar/formats.rb, line 92
def to_s
  g = Macrocosm.new(curveness: 0.2)

  each_nodes do |n|
    g.add_node(n ,n)
  end

  each_links do |n1, var_name, n2|
    g.add_link(n1, n2, relation_in_list: var_name, relation_in_graph: var_name)
  end

  g.to_s
end