Module: Recursivar::Formats::Graph
- Defined in:
- lib/recursivar/formats.rb
Instance Method Summary collapse
Instance Method Details
#each_links(&block) ⇒ Object
81 82 83 84 85 86 |
# File 'lib/recursivar/formats.rb', line 81 def each_links(&block) vars.each do |v| block.call(label, v.name, v.label) v.each_links(&block) end end |
#each_nodes(&block) ⇒ Object
74 75 76 77 78 79 |
# 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 ⇒ Object
88 89 90 |
# File 'lib/recursivar/formats.rb', line 88 def label "#<#{klass}:#{obj.object_id}>" end |
#to_s ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# 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 |