Class Gem::SourceInfoCacheEntry
In: lib/rubygems/source_info_cache_entry.rb
Parent: Object

Entries held by a SourceInfoCache.

Methods

new   refresh  

Attributes

size  [R]  The size of the source entry. Used to determine if the source index has changed.
source_index  [R]  The source index for this cache entry.

Public Class methods

Create a cache entry.

[Source]

    # File lib/rubygems/source_info_cache_entry.rb, line 24
24:   def initialize(si, size)
25:     @source_index = si || Gem::SourceIndex.new({})
26:     @size = size
27:     @all = false
28:   end

Public Instance methods

[Source]

    # File lib/rubygems/source_info_cache_entry.rb, line 30
30:   def refresh(source_uri, all)
31:     begin
32:       marshal_uri = URI.join source_uri.to_s, "Marshal.#{Gem.marshal_version}"
33:       remote_size = Gem::RemoteFetcher.fetcher.fetch_size marshal_uri
34:     rescue Gem::RemoteSourceException
35:       yaml_uri = URI.join source_uri.to_s, 'yaml'
36:       remote_size = Gem::RemoteFetcher.fetcher.fetch_size yaml_uri
37:     end
38: 
39:     # TODO Use index_signature instead of size?
40:     return false if @size == remote_size and @all
41: 
42:     updated = @source_index.update source_uri, all
43:     @size = remote_size
44:     @all = all
45: 
46:     updated
47:   end

[Validate]