Class: ControllersDiagram
- Inherits:
-
AppDiagram
- Object
- AppDiagram
- ControllersDiagram
- Defined in:
- lib/railroad/controllers_diagram.rb
Overview
RailRoad controllers diagram
Instance Method Summary collapse
-
#generate ⇒ Object
Process controller files.
-
#initialize(options) ⇒ ControllersDiagram
constructor
A new instance of ControllersDiagram.
Methods inherited from AppDiagram
Constructor Details
#initialize(options) ⇒ ControllersDiagram
Returns a new instance of ControllersDiagram.
10 11 12 13 14 |
# File 'lib/railroad/controllers_diagram.rb', line 10 def initialize() #options.exclude.map! {|e| "app/controllers/" + e} super @graph.diagram_type = 'Controllers' end |
Instance Method Details
#generate ⇒ Object
Process controller files
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/railroad/controllers_diagram.rb', line 17 def generate STDERR.print "Generating controllers diagram\n" if @options.verbose files = Dir.glob("app/controllers/**/*_controller.rb") - @options.exclude files << 'app/controllers/application.rb' files.each do |f| class_name = extract_class_name('app/controllers/', f) # ApplicationController's file is 'application.rb' class_name += 'Controller' if class_name == 'Application' process_class class_name.constantize end end |