# File lib/pry/default_commands/introspection.rb, line 288
        def process_patch
          lines = @method.source.lines.to_a

          if ((original_name = @method.original_name) &&
              lines[0] =~ /^def (?:.*?\.)?#{original_name}(?=[\(\s;]|$)/)
            lines[0] = "def #{original_name}#{$'}"
          else
            raise CommandError, "Pry can only patch methods created with the `def` keyword."
          end

          temp_file do |f|
            f.puts lines.join
            f.flush
            invoke_editor(f.path, 0)

            if @method.alias?
              with_method_transaction(original_name, @method.owner) do
                Pry.new(:input => StringIO.new(File.read(f.path))).rep(@method.owner)
                Pry.binding_for(@method.owner).eval("alias #{@method.name} #{original_name}")
              end
            else
              Pry.new(:input => StringIO.new(File.read(f.path))).rep(@method.owner)
            end
          end
        end