# File lib/mocha/any_instance_method.rb, line 14 def hide_original_method return unless (@original_visibility = method_visibility(method)) begin if RUBY_V2_PLUS @definition_target = PrependedModule.new stubbee.__send__ :prepend, @definition_target else @original_method = stubbee.instance_method(method) if @original_method && @original_method.owner == stubbee stubbee.send(:remove_method, method) end end # rubocop:disable Lint/HandleExceptions rescue NameError # deal with nasties like ActiveRecord::Associations::AssociationProxy end # rubocop:enable Lint/HandleExceptions end