Class: AasmDiagram

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

Overview

Diagram for Acts As State Machine

Instance Method Summary collapse

Methods inherited from AppDiagram

#print

Constructor Details

#initialize(options) ⇒ AasmDiagram

Returns a new instance of AasmDiagram.



12
13
14
15
16
17
18
# File 'lib/railroad/aasm_diagram.rb', line 12

def initialize(options)
  #options.exclude.map! {|e| e = "app/models/" + e}
  super options 
  @graph.diagram_type = 'Models'
  # Processed habtm associations
  @habtm = []
end

Instance Method Details

#generateObject

Process model files



21
22
23
24
25
26
27
28
29
# File 'lib/railroad/aasm_diagram.rb', line 21

def generate
  STDERR.print "Generating AASM diagram\n" if @options.verbose
  files = Dir.glob("app/models/*.rb") 
  files += Dir.glob("vendor/plugins/**/app/models/*.rb") if @options.plugins_models
  files -= @options.exclude
  files.each do |f| 
    process_class extract_class_name('app/models/', f).constantize
  end
end