Method: Debian::AptPkg::PkgCache.version_count

Defined in:
ext/apt_pkg/pkgcache.cpp

.version_countInteger?

The total number of package versions available in the cache. Raise ‘Debian::AptPkg::InitError` when config, system, cache is not configured.

Debian::AptPkg::PkgCache.version_count # => 84630

Returns:

  • (Integer, nil)

223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'ext/apt_pkg/pkgcache.cpp', line 223

static VALUE
version_count(VALUE self)
{
  if (!config_system_initialized()) {
    rb_raise(e_mDebianAptPkgInitError, "System not initialized");
  }
  pkgCacheFile CacheFile;
  pkgCache *Cache = CacheFile.GetPkgCache();
  if (Cache == NULL) {
    return Qnil;
  }
  return INT2FIX(Cache->HeaderP->VersionCount);
}