Class: DeadCodeDetector::ClassMethodWrapper

Inherits:
BaseMethodWrapper show all
Defined in:
lib/dead_code_detector/class_method_wrapper.rb

Instance Attribute Summary

Attributes inherited from BaseMethodWrapper

#klass

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseMethodWrapper

#clear_cache, #initialize, #number_of_tracked_methods, #refresh_cache, track_method, #wrap_methods!

Constructor Details

This class inherits a constructor from DeadCodeDetector::BaseMethodWrapper

Class Method Details

.record_key(class_name) ⇒ Object



14
15
16
# File 'lib/dead_code_detector/class_method_wrapper.rb', line 14

def record_key(class_name)
  "dead_code_detector/record_keeper/#{class_name}/class_methods"
end

.unwrap_method(klass, original_method) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/dead_code_detector/class_method_wrapper.rb', line 5

def unwrap_method(klass, original_method)
  if klass.singleton_class == original_method.owner
    klass.define_singleton_method(original_method.name, original_method)
  else
    klass.singleton_class.send(:remove_method, original_method.name)
  end
  track_method(klass, original_method.name)
end

Instance Method Details

#get_method(method_name) ⇒ Object



19
20
21
# File 'lib/dead_code_detector/class_method_wrapper.rb', line 19

def get_method(method_name)
  klass.method(method_name)
end