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
1311 1312 1313 1314 1315 1316 1317 |
# File 'lib/rubygems/test_case.rb', line 1311 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.
1306 1307 1308 |
# File 'lib/rubygems/test_case.rb', line 1306 def remote @remote end |
Instance Method Details
#add(spec) ⇒ Object
Adds spec
to this set.
1322 1323 1324 |
# File 'lib/rubygems/test_case.rb', line 1322 def add spec @specs << spec end |
#find_all(dep) ⇒ Object
Finds all gems matching dep
in this set.
1338 1339 1340 |
# File 'lib/rubygems/test_case.rb', line 1338 def find_all(dep) @specs.find_all { |s| dep.match? s, @prerelease } end |
#find_spec(dep) ⇒ Object
Finds dep
in this set.
1329 1330 1331 1332 1333 |
# File 'lib/rubygems/test_case.rb', line 1329 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.
1346 1347 1348 1349 1350 1351 1352 1353 |
# File 'lib/rubygems/test_case.rb', line 1346 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:
1355 1356 |
# File 'lib/rubygems/test_case.rb', line 1355 def prefetch reqs # :nodoc: end |