# File lib/mocha/class_method.rb, line 38 def hide_original_method return unless (@original_visibility = method_visibility(method)) begin if RUBY_V2_PLUS @definition_target = PrependedModule.new stubbee.__metaclass__.__send__ :prepend, @definition_target else @original_method = stubbee._method(method) if @original_method && @original_method.owner == stubbee.__metaclass__ stubbee.__metaclass__.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