Class: ControllersDiagram

Inherits:
AppDiagram show all
Defined in:
lib/railroad/controllers_diagram.rb

Overview

RailRoad controllers diagram

Instance Method Summary collapse

Methods inherited from AppDiagram

#print, #to_s

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)
  #options.exclude.map! {|e| "app/controllers/" + e}
  super options
  @graph.diagram_type = 'Controllers'
end

Instance Method Details

#generateObject

Process controller files



17
18
19
20
21
22
23
24
25
# 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.each do |f|
    class_name = extract_class_name('app/controllers/', f)
    process_class class_name.constantize
  end
end