Class: LatentObjectDetector::Detector
- Inherits:
-
Object
- Object
- LatentObjectDetector::Detector
- Defined in:
- lib/latent_object_detector.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
Returns the value of attribute klass.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(klass) ⇒ Detector
constructor
A new instance of Detector.
- #potential_objects ⇒ Object
- #suspicious_methods ⇒ Object
Constructor Details
#initialize(klass) ⇒ Detector
Returns a new instance of Detector.
11 12 13 |
# File 'lib/latent_object_detector.rb', line 11 def initialize(klass) self.klass = klass end |
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
5 6 7 |
# File 'lib/latent_object_detector.rb', line 5 def klass @klass end |
Class Method Details
.for(klass) ⇒ Object
7 8 9 |
# File 'lib/latent_object_detector.rb', line 7 def self.for(klass) new(klass) end |
Instance Method Details
#potential_objects ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/latent_object_detector.rb', line 20 def potential_objects @potential_objects ||= begin common_words = find_common_words_in(hash_of_words_used_in_methods) words_used_more_than_twice(common_words) end end |
#suspicious_methods ⇒ Object
15 16 17 18 |
# File 'lib/latent_object_detector.rb', line 15 def suspicious_methods @suspicious_methods ||= methods_owned_by_klass.select{ |m| (words_in_method(m.to_s) & potential_objects).size > 0 } end |