Class: Gem::DependencyResolver::IndexSet
- Inherits:
-
Object
- Object
- Gem::DependencyResolver::IndexSet
- Defined in:
- lib/rubygems/dependency_resolver.rb
Overview
The global rubygems pool represented via the traditional source index.
Instance Method Summary collapse
-
#find_all(req) ⇒ Object
Return an array of IndexSpecification objects matching DependencyRequest
req
. -
#initialize ⇒ IndexSet
constructor
A new instance of IndexSet.
-
#load_spec(name, ver, source) ⇒ Object
Called from IndexSpecification to get a true Specification object.
-
#prefetch(gems) ⇒ Object
No prefetching needed since we load the whole index in initially.
Constructor Details
#initialize ⇒ IndexSet
Returns a new instance of IndexSet.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/rubygems/dependency_resolver.rb', line 181 def initialize @f = Gem::SpecFetcher.fetcher @all = Hash.new { |h,k| h[k] = [] } list, _ = @f.available_specs(:released) list.each do |uri, specs| specs.each do |n| @all[n.name] << [uri, n] end end @specs = {} end |
Instance Method Details
#find_all(req) ⇒ Object
Return an array of IndexSpecification objects matching DependencyRequest req
.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/rubygems/dependency_resolver.rb', line 199 def find_all(req) res = [] name = req.dependency.name @all[name].each do |uri, n| if req.dependency.match? n res << IndexSpecification.new(self, n.name, n.version, uri, n.platform) end end res end |
#load_spec(name, ver, source) ⇒ Object
Called from IndexSpecification to get a true Specification object.
223 224 225 226 |
# File 'lib/rubygems/dependency_resolver.rb', line 223 def load_spec(name, ver, source) key = "#{name}-#{ver}" @specs[key] ||= source.fetch_spec(Gem::NameTuple.new(name, ver)) end |
#prefetch(gems) ⇒ Object
No prefetching needed since we load the whole index in initially.
217 218 |
# File 'lib/rubygems/dependency_resolver.rb', line 217 def prefetch(gems) end |