Class: Gem::TestCase::StaticSet
- Inherits:
-
Object
- Object
- 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 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:.
Constructor Details
#initialize(specs) ⇒ StaticSet
Creates a new StaticSet for the given specs
1250 1251 1252 |
# File 'lib/rubygems/test_case.rb', line 1250 def initialize(specs) @specs = specs end |
Instance Method Details
#add(spec) ⇒ Object
Adds spec
to this set.
1257 1258 1259 |
# File 'lib/rubygems/test_case.rb', line 1257 def add spec @specs << spec end |
#find_all(dep) ⇒ Object
Finds all gems matching dep
in this set.
1273 1274 1275 |
# File 'lib/rubygems/test_case.rb', line 1273 def find_all(dep) @specs.find_all { |s| dep.matches_spec? s } end |
#find_spec(dep) ⇒ Object
Finds dep
in this set.
1264 1265 1266 1267 1268 |
# File 'lib/rubygems/test_case.rb', line 1264 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.
1281 1282 1283 1284 1285 1286 1287 1288 |
# File 'lib/rubygems/test_case.rb', line 1281 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:
1290 1291 |
# File 'lib/rubygems/test_case.rb', line 1290 def prefetch reqs # :nodoc: end |