Class: Delfos::Patching::Unstubber
- Inherits:
-
Object
- Object
- Delfos::Patching::Unstubber
- Extended by:
- ModuleDefiningMethods
- Defined in:
- lib/delfos/patching/unstubber.rb
Class Method Summary collapse
Methods included from ModuleDefiningMethods
Class Method Details
.unstub!(klass, method_name, class_method) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/delfos/patching/unstubber.rb', line 23 def self.unstub!(klass, method_name, class_method) module_definition(klass, method_name, class_method) do |m| begin remove_method :"#{method_name}" rescue NameError => e raise unless e.["method `#{method_name}' not defined in"] end end end |
.unstub_all! ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/delfos/patching/unstubber.rb', line 7 def self.unstub_all! MUTEX.synchronize do Thread.current[:__delfos_disable_patching] = true end MethodCache.each_method do |klass_name, method, class_method| klass = eval(klass_name) unstub!(klass, method.name, class_method) end MUTEX.synchronize do Thread.current[:__delfos_disable_patching] = false end end |