[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
This commit is contained in:
David Rodríguez 2019-04-25 15:57:41 +02:00 коммит произвёл Hiroshi SHIBATA
Родитель 89ad5df979
Коммит f42ad4a425
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -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