ruby/rubygems-2.2.0-DRY-Use-full...

72 lines
2.0 KiB
Diff

From 02f94e96ea6a9e0fe37341eccd83ffb63549ead5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 3 Oct 2013 14:15:59 +0200
Subject: [PATCH] DRY: Use full_require_paths on yet another place.
---
lib/rubygems/basic_specification.rb | 16 +++++++++++++---
lib/rubygems/specification.rb | 11 -----------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 24bb4bc..a10eab3 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -38,11 +38,10 @@ class Gem::BasicSpecification
# Return true if this spec can require +file+.
def contains_requirable_file? file
- root = full_gem_path
suffixes = Gem.suffixes
- require_paths.any? do |lib|
- base = "#{root}/#{lib}/#{file}"
+ full_require_paths.any? do |path|
+ base = "#{path}/#{file}"
suffixes.any? { |suf| File.file? "#{base}#{suf}" }
end
end
@@ -84,6 +83,17 @@ class Gem::BasicSpecification
end
##
+ # Full paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
+ # activated.
+ #
+
+ def full_require_paths
+ require_paths.map do |path|
+ File.join full_gem_path, path
+ end
+ end
+
+ ##
# Returns the full path to the gems directory containing this spec's
# gem directory. eg: /usr/local/lib/ruby/1.8/gems
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 6de8c3b..deac343 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -2015,17 +2015,6 @@ class Gem::Specification < Gem::BasicSpecification
end
##
- # Full paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
- # activated.
- #
-
- def full_require_paths
- require_paths.map do |path|
- File.join full_gem_path, path
- end
- end
-
- ##
# The RubyGems version required by this gem
def required_rubygems_version= req
--
1.8.3.1