Sha256: a86119a704c5abfc9791195742e333b24fa5c67badaebe1381c1a053f6424f17

Contents?: true

Size: 815 Bytes

Versions: 2

Compression:

Stored size: 815 Bytes

Contents

module Fig; end

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

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

    versions[package.version_name] = 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

2 entries across 2 versions & 1 rubygems

Version Path
fig-0.1.57 lib/fig/packagecache.rb
fig-0.1.55 lib/fig/packagecache.rb