Module: Laser::Analysis::MethodAnalysis

Extended by:
IncorrectPredicateMethodDetection, UnusedMethodDetection
Defined in:
lib/laser/analysis/method_analysis/method_analysis.rb

Overview

General-purpose method analysis functions.

Class Method Summary collapse

Methods included from IncorrectPredicateMethodDetection

correct_predicate_type?, incorrect_predicate_methods

Methods included from UnusedMethodDetection

unused_methods

Class Method Details

.each_user_methodObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/laser/analysis/method_analysis/method_analysis.rb', line 9

def self.each_user_method
  return enum_for(__method__) unless block_given?
  classes = Set[]
  Analysis::ProtocolRegistry.class_protocols.each do |key, klass|
    if should_analyze?(klass) && !classes.include?(klass)
      classes << klass
      klass.__all_instance_methods(false).each do |name|
        yield klass.instance_method(name)
      end
    end
  end
end

.should_analyze?(klass) ⇒ Boolean



22
23
24
25
# File 'lib/laser/analysis/method_analysis/method_analysis.rb', line 22

def self.should_analyze?(klass)
  !(Analysis::LaserSingletonClass === klass) ||
    klass < ClassRegistry['Module']
end