Sha256: df75369c37b05a172799631c9bcc7fff5994f14470a2c2105cc073e32d30444c

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

require 'rubygems'
require 'rubygems/source_index'
require 'rubygems/remote_fetcher'

##
# Entrys held by a SourceInfoCache.

class Gem::SourceInfoCacheEntry

  # The source index for this cache entry.
  attr_reader :source_index

  # The size of the of the source entry.  Used to determine if the
  # source index has changed.
  attr_reader :size

  # Create a cache entry.
  def initialize(si, size)
    @source_index = si || Gem::SourceIndex.new({})
    @size = size
  end

  def refresh(source_uri)
    remote_size = Gem::RemoteFetcher.fetcher.fetch_size source_uri + '/yaml'
    return if @size == remote_size # HACK bad check, local cache not YAML
    @source_index.update source_uri
    @size = remote_size
  end

  def ==(other) # :nodoc:
    self.class === other and
    @size == other.size and
    @source_index == other.source_index
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubygems-update-0.9.4 lib/rubygems/source_info_cache_entry.rb