Class: AppDiagram
- Inherits:
-
Object
- Object
- AppDiagram
- Defined in:
- lib/prailroady/app_diagram.rb
Overview
Root class for PrailRoady diagrams
Direct Known Subclasses
Instance Method Summary collapse
-
#engines ⇒ Object
get all engines.
-
#initialize(options = OptionsStruct.new) ⇒ AppDiagram
constructor
A new instance of AppDiagram.
-
#print ⇒ Object
Print diagram.
- #process ⇒ Object
Constructor Details
#initialize(options = OptionsStruct.new) ⇒ AppDiagram
Returns a new instance of AppDiagram.
11 12 13 14 15 16 |
# File 'lib/prailroady/app_diagram.rb', line 11 def initialize( = OptionsStruct.new) @options = @graph = DiagramGraph.new @graph.show_label = @options.label @graph.alphabetize = @options.alphabetize end |
Instance Method Details
#engines ⇒ Object
get all engines
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/prailroady/app_diagram.rb', line 46 def engines engines = [] if defined?(Rails) engines = if Rails::Application::Railties.respond_to?(:engines) Rails::Application::Railties.engines else # rails 4 way of getting engines Rails::Engine.subclasses.map(&:instance) end end engines end |
#print ⇒ Object
Print diagram
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/prailroady/app_diagram.rb', line 19 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 $stdout.reopen(old_stdout) if @options.output end |
#process ⇒ Object
41 42 43 |
# File 'lib/prailroady/app_diagram.rb', line 41 def process load_environment end |