method
draw
v1_9_1_378 -
Show latest stable
- Class:
RDoc::Diagram
draw()public
Draw the diagrams. We traverse the files, drawing a diagram for each. We also traverse each top-level class and module in that file drawing a diagram for these too.
# File lib/rdoc/diagram.rb, line 50
def draw
unless @options.quiet
$stderr.print "Diagrams: "
$stderr.flush
end
@info.each_with_index do |i, file_count|
@done_modules = {}
@local_names = find_names(i)
@global_names = []
@global_graph = graph = DOT::Digraph.new('name' => 'TopLevel',
'fontname' => FONT,
'fontsize' => '8',
'bgcolor' => 'lightcyan1',
'compound' => 'true')
# it's a little hack %) i'm too lazy to create a separate class
# for default node
graph << DOT::Node.new('name' => 'node',
'fontname' => FONT,
'color' => 'black',
'fontsize' => 8)
i.modules.each do |mod|
draw_module(mod, graph, true, i.file_relative_name)
end
add_classes(i, graph, i.file_relative_name)
i.diagram = convert_to_png("f_#{file_count}", graph)
# now go through and document each top level class and
# module independently
i.modules.each_with_index do |mod, count|
@done_modules = {}
@local_names = find_names(mod)
@global_names = []
@global_graph = graph = DOT::Digraph.new('name' => 'TopLevel',
'fontname' => FONT,
'fontsize' => '8',
'bgcolor' => 'lightcyan1',
'compound' => 'true')
graph << DOT::Node.new('name' => 'node',
'fontname' => FONT,
'color' => 'black',
'fontsize' => 8)
draw_module(mod, graph, true)
mod.diagram = convert_to_png("m_#{file_count}_#{count}",
graph)
end
end
$stderr.puts unless @options.quiet
end Related methods
- Instance methods
- draw
- Class methods
- new
- Private methods
-
add_classes -
convert_to_png -
draw_module -
find_full_name -
find_names -
wrap_in_image_map