summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/basic_specification.rb18
-rw-r--r--lib/rubygems/specification.rb10
2 files changed, 13 insertions, 15 deletions
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 3c69a5a2fe..ca32ffe87a 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -170,18 +170,14 @@ class Gem::BasicSpecification
def to_fullpath(path)
if activated?
@paths_map ||= {}
- @paths_map[path] ||=
- begin
- fullpath = nil
- suffixes = Gem.suffixes
- if suffixes.find do |suf|
- full_require_paths.find do |dir|
- File.file?(fullpath = "#{dir}/#{path}#{suf}")
- end
- end
- fullpath
- end
+ Gem.suffixes.each do |suf|
+ full_require_paths.each do |dir|
+ fullpath = "#{dir}/#{path}#{suf}"
+ next unless File.file?(fullpath)
+ @paths_map[path] ||= fullpath
end
+ end
+ @paths_map[path]
end
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index a66d48fc37..f6590cfada 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1031,9 +1031,10 @@ class Gem::Specification < Gem::BasicSpecification
def self.find_by_path(path)
path = path.dup.freeze
- spec = @@spec_with_requirable_file[path] ||= (stubs.find do |s|
+ spec = @@spec_with_requirable_file[path] ||= stubs.find do |s|
s.contains_requirable_file? path
- end || NOT_FOUND)
+ end || NOT_FOUND
+
spec.to_spec
end
@@ -1050,9 +1051,10 @@ class Gem::Specification < Gem::BasicSpecification
end
def self.find_active_stub_by_path(path)
- stub = @@active_stub_with_requirable_file[path] ||= (stubs.find do |s|
+ stub = @@active_stub_with_requirable_file[path] ||= stubs.find do |s|
s.activated? && s.contains_requirable_file?(path)
- end || NOT_FOUND)
+ end || NOT_FOUND
+
stub.this
end