Class: DeadCodeDetector::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/dead_code_detector/report.rb

Class Method Summary collapse

Class Method Details

.unused_methodsObject



6
7
8
9
10
# File 'lib/dead_code_detector/report.rb', line 6

def unused_methods
  Initializer.cached_classes.flat_map do |class_name|
    unused_methods_for(class_name)
  end
end

.unused_methods_for(class_name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/dead_code_detector/report.rb', line 12

def unused_methods_for(class_name)
  methods = []
  unused_class_methods_for(class_name).each_with_object(methods) do |method_name, collection|
    collection << "#{class_name}.#{method_name}"
  end
  unused_instance_methods_for(class_name).each_with_object(methods) do |method_name, collection|
    collection << "#{class_name}##{method_name}"
  end
  methods
end