Class: RailsGraph::Inspector

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_graph/inspector.rb

Instance Method Summary collapse

Constructor Details

#initializeInspector

Returns a new instance of Inspector.



7
8
9
10
# File 'lib/rails_graph/inspector.rb', line 7

def initialize
  @classes = Set.new
  @associations = Set.new
end

Instance Method Details

#add_association(association) ⇒ Object



16
17
18
# File 'lib/rails_graph/inspector.rb', line 16

def add_association(association)
  @associations.add(association)
end

#add_class(klass) ⇒ Object



12
13
14
# File 'lib/rails_graph/inspector.rb', line 12

def add_class(klass)
  @classes.add(klass)
end

#logObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/rails_graph/inspector.rb', line 20

def log
  @classes.each do |klass|
    puts "[WARN][RailsGraph]: Invalid class configuration: #{klass}"
  end

  @associations.each do |association|
    puts "[WARN][RailsGraph]: #{association.name} association defined " \
         "under #{association.active_record.name} class has invalid configurations!"
  end
end