Class: Gem::SourceInfoCacheEntry
- Inherits:
-
Object
- Object
- Gem::SourceInfoCacheEntry
- Defined in:
- lib/rubygems/source_info_cache_entry.rb
Overview
Entrys held by a SourceInfoCache.
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
The size of the of the source entry.
-
#source_index ⇒ Object
readonly
The source index for this cache entry.
Instance Method Summary collapse
-
#initialize(si, size) ⇒ SourceInfoCacheEntry
constructor
Create a cache entry.
- #refresh(source_uri) ⇒ Object
Constructor Details
#initialize(si, size) ⇒ SourceInfoCacheEntry
Create a cache entry.
18 19 20 21 |
# File 'lib/rubygems/source_info_cache_entry.rb', line 18 def initialize(si, size) @source_index = si || Gem::SourceIndex.new({}) @size = size end |
Instance Attribute Details
#size ⇒ Object (readonly)
The size of the of the source entry. Used to determine if the source index has changed.
15 16 17 |
# File 'lib/rubygems/source_info_cache_entry.rb', line 15 def size @size end |
#source_index ⇒ Object (readonly)
The source index for this cache entry.
11 12 13 |
# File 'lib/rubygems/source_info_cache_entry.rb', line 11 def source_index @source_index end |
Instance Method Details
#refresh(source_uri) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rubygems/source_info_cache_entry.rb', line 23 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 |