Object
@private
# File lib/shoulda/matchers/doublespeak/double.rb, line 24 def activate unless @activated store_original_method replace_method_with_double @activated = true end end
# File lib/shoulda/matchers/doublespeak/double.rb, line 43 def call_original_method(object, args, block) if original_method original_method.bind(object).call(*args, &block) end end
# File lib/shoulda/matchers/doublespeak/double.rb, line 32 def deactivate if @activated restore_original_method @activated = false end end
# File lib/shoulda/matchers/doublespeak/double.rb, line 57 def replace_method_with_double implementation = @implementation double = self klass.__send__(:define_method, method_name) do |*args, &block| implementation.call(double, self, args, block) end end
# File lib/shoulda/matchers/doublespeak/double.rb, line 66 def restore_original_method original_method = @original_method klass.__send__(:remove_method, method_name) klass.__send__(:define_method, method_name) do |*args, &block| original_method.bind(self).call(*args, &block) end end
Generated with the Darkfish Rdoc Generator 2.