summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-25 15:57:41 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-17 07:35:48 +0900
commitf42ad4a4250620ca64b2f668fed91d475934eaa7 (patch)
tree6ccadfe69a3a5e15e0422081b57646671859b877 /lib/rubygems.rb
parent89ad5df979727ab50eee6106550bf58b1888486e (diff)
[rubygems/rubygems] Little refactor
There's already a method called `suffix_pattern`, that's different from this local variable. So, move the local variable to a `suffix_regexp` that clearly differenciates from `suffix_pattern`. https://github.com/rubygems/rubygems/commit/4ec69c48b9
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 84c1c74..85790fc 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1024,6 +1024,10 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
@suffix_pattern ||= "{#{suffixes.join(',')}}"
end
+ def self.suffix_regexp
+ @suffix_regexp ||= /#{Regexp.union(suffixes)}\z/
+ end
+
##
# Suffixes for require-able paths.
@@ -1274,8 +1278,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
prefix_pattern = /^(#{prefix_group})/
end
- suffix_pattern = /#{Regexp.union(Gem.suffixes)}\z/
-
spec.files.each do |file|
if new_format
file = file.sub(prefix_pattern, "")
@@ -1283,7 +1285,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
end
@path_to_default_spec_map[file] = spec
- @path_to_default_spec_map[file.sub(suffix_pattern, "")] = spec
+ @path_to_default_spec_map[file.sub(suffix_regexp, "")] = spec
end
end