diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-07 00:53:01 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-07 00:53:01 +0000 |
commit | 97f80207d0f0d13f28a419d8c92e96bb9064096a (patch) | |
tree | de416fff9bbc978434cb4c1185099151df2ac27c /lib/rubygems/stub_specification.rb | |
parent | a0b80a44101708b5d66cdd87f16c98277954a77c (diff) | |
download | ruby-97f80207d0f0d13f28a419d8c92e96bb9064096a.tar.gz |
* lib/rubygems: Update to RubyGems 2.4.5.
* test/rubygems: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/stub_specification.rb')
-rw-r--r-- | lib/rubygems/stub_specification.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb index 49a6df43a3..b184d29d5e 100644 --- a/lib/rubygems/stub_specification.rb +++ b/lib/rubygems/stub_specification.rb @@ -42,6 +42,7 @@ class Gem::StubSpecification < Gem::BasicSpecification self.loaded_from = filename @data = nil @extensions = nil + @name = nil @spec = nil end @@ -49,8 +50,11 @@ class Gem::StubSpecification < Gem::BasicSpecification # True when this gem has been activated def activated? - loaded = Gem.loaded_specs[name] - loaded && loaded.version == version + @activated ||= + begin + loaded = Gem.loaded_specs[name] + loaded && loaded.version == version + end end def build_extensions # :nodoc: @@ -154,9 +158,11 @@ class Gem::StubSpecification < Gem::BasicSpecification # The full Gem::Specification for this gem, loaded from evalling its gemspec def to_spec - @spec ||= Gem.loaded_specs.values.find { |spec| - spec.name == @name and spec.version == @version - } + @spec ||= if @data then + Gem.loaded_specs.values.find { |spec| + spec.name == name and spec.version == version + } + end @spec ||= Gem::Specification.load(loaded_from) @spec.ignored = @ignored if instance_variable_defined? :@ignored |