Sha256: e436636202f63568b3f775c3e2e1fea4d0a64aaa1d732f77e538bcc2804e9c64

Contents?: true

Size: 810 Bytes

Versions: 45

Compression:

Stored size: 810 Bytes

Contents

module Fig; end

# Simple double-level (name, version) cache of Packages.
class Fig::PackageCache
  def initialize()
    @packages = {}
  end

  def add_package(package)
    versions = @packages[package.name]
    if not versions
      versions = {}
      @packages[package.name] = versions
    end

    versions[package.version] = package

    return
  end

  def get_package(name, version)
    versions = @packages[name]
    return if not versions

    return versions[version]
  end

  # Don't care which one, just gimme.
  def get_any_version_of_package(name)
    versions = @packages[name]
    return if not versions

    return versions.values.first()
  end

  def remove_package(name, version)
    versions = @packages[name]
    return if not versions

    versions.delete(version)

    return
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
fig-0.1.71 lib/fig/package_cache.rb
fig-0.1.69 lib/fig/package_cache.rb
fig-0.1.67 lib/fig/package_cache.rb
fig-0.1.65 lib/fig/packagecache.rb
fig-0.1.64 lib/fig/packagecache.rb