class IRB::JobManager

def delete(key)

Deletes the job at the given +key+.
def delete(key)
  case key
  when Integer
    fail NoSuchJob, key unless @jobs[key]
    @jobs[key] = nil
  else
    catch(:EXISTS) do
      @jobs.each_index do
        |i|
        if @jobs[i] and (@jobs[i][0] == key ||
            @jobs[i][1] == key ||
            @jobs[i][1].context.main.equal?(key))
          @jobs[i] = nil
          throw :EXISTS
        end
      end
      fail NoSuchJob, key
    end
  end
  until assoc = @jobs.pop; end unless @jobs.empty?
  @jobs.push assoc
end