In Files

  • rubygems/source_info_cache_entry.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

Gem::SourceInfoCacheEntry

Entries held by a SourceInfoCache.

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

new(si, size) click to toggle source

Create a cache entry.

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

Public Instance Methods

refresh(source_uri, all) click to toggle source
 
               # File rubygems/source_info_cache_entry.rb, line 30
def refresh(source_uri, all)
  begin
    marshal_uri = URI.join source_uri.to_s, "Marshal.#{Gem.marshal_version}"
    remote_size = Gem::RemoteFetcher.fetcher.fetch_size marshal_uri
  rescue Gem::RemoteSourceException
    yaml_uri = URI.join source_uri.to_s, 'yaml'
    remote_size = Gem::RemoteFetcher.fetcher.fetch_size yaml_uri
  end

  # TODO Use index_signature instead of size?
  return false if @size == remote_size and @all

  updated = @source_index.update source_uri, all
  @size = remote_size
  @all = all

  updated
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus