Class: Gem::TestCase::StaticSet
- Inherits:
-
Resolver::Set
- Object
- Resolver::Set
- Gem::TestCase::StaticSet
- Defined in:
- lib/rubygems/test_case.rb
Overview
The StaticSet is a static set of gem specifications used for testing only. It is available by requiring Gem::TestCase.
Instance Attribute Summary collapse
-
#remote ⇒ Object
A StaticSet ignores remote because it has a fixed set of gems.
Attributes inherited from Resolver::Set
Instance Method Summary collapse
-
#add(spec) ⇒ Object
Adds
spec
to this set. -
#find_all(dep) ⇒ Object
Finds all gems matching
dep
in this set. -
#find_spec(dep) ⇒ Object
Finds
dep
in this set. -
#initialize(specs) ⇒ StaticSet
constructor
Creates a new StaticSet for the given
specs
. -
#load_spec(name, ver, platform, source) ⇒ Object
Loads a Gem::Specification from this set which has the given
name
, versionver
,platform
. -
#prefetch(reqs) ⇒ Object
:nodoc:.
Methods inherited from Resolver::Set
Constructor Details
#initialize(specs) ⇒ StaticSet
Creates a new StaticSet for the given specs
1368 1369 1370 1371 1372 1373 1374 |
# File 'lib/rubygems/test_case.rb', line 1368 def initialize(specs) super() @specs = specs @remote = true end |
Instance Attribute Details
#remote ⇒ Object
A StaticSet ignores remote because it has a fixed set of gems.
1363 1364 1365 |
# File 'lib/rubygems/test_case.rb', line 1363 def remote @remote end |
Instance Method Details
#add(spec) ⇒ Object
Adds spec
to this set.
1379 1380 1381 |
# File 'lib/rubygems/test_case.rb', line 1379 def add spec @specs << spec end |
#find_all(dep) ⇒ Object
Finds all gems matching dep
in this set.
1395 1396 1397 |
# File 'lib/rubygems/test_case.rb', line 1395 def find_all(dep) @specs.find_all { |s| dep.match? s, @prerelease } end |
#find_spec(dep) ⇒ Object
Finds dep
in this set.
1386 1387 1388 1389 1390 |
# File 'lib/rubygems/test_case.rb', line 1386 def find_spec(dep) @specs.reverse_each do |s| return s if dep.matches_spec? s end end |
#load_spec(name, ver, platform, source) ⇒ Object
Loads a Gem::Specification from this set which has the given name
, version ver
, platform
. The source
is ignored.
1403 1404 1405 1406 1407 1408 1409 1410 |
# File 'lib/rubygems/test_case.rb', line 1403 def load_spec name, ver, platform, source dep = Gem::Dependency.new name, ver spec = find_spec dep Gem::Specification.new spec.name, spec.version do |s| s.platform = spec.platform end end |
#prefetch(reqs) ⇒ Object
:nodoc:
1412 1413 |
# File 'lib/rubygems/test_case.rb', line 1412 def prefetch reqs # :nodoc: end |