Class: AppDiagram
- Inherits:
-
Object
- Object
- AppDiagram
- Defined in:
- lib/railroad/app_diagram.rb
Overview
Root class for RailRoad diagrams
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(options) ⇒ AppDiagram
constructor
A new instance of AppDiagram.
-
#print ⇒ Object
Print diagram.
Constructor Details
#initialize(options) ⇒ AppDiagram
Returns a new instance of AppDiagram.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/railroad/app_diagram.rb', line 10 def initialize() @options = @graph = DiagramGraph.new @graph.show_label = @options.label STDERR.print "Loading application environment\n" if @options.verbose load_environment STDERR.print "Loading application classes\n" if @options.verbose load_classes end |
Instance Method Details
#print ⇒ Object
Print diagram
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/railroad/app_diagram.rb', line 23 def print if @options.output old_stdout = STDOUT.dup begin STDOUT.reopen(@options.output) rescue STDERR.print "Error: Cannot write diagram to #{@options.output}\n\n" exit 2 end end if @options.xmi STDERR.print "Generating XMI diagram\n" if @options.verbose STDOUT.print @graph.to_xmi else STDERR.print "Generating DOT graph\n" if @options.verbose STDOUT.print @graph.to_dot end if @options.output STDOUT.reopen(old_stdout) end end |