From 2927c280950924c0aaa6c1a5805b2978b177809e Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Mon, 27 Nov 2023 16:01:51 -0600 Subject: [rubygems/rubygems] Avoid re-compiling static regexp in a loop Pathname::SEPARATOR_PAT is a constant and can safely be interpolated once, avoiding creating a new regexp object on every iteration https://github.com/rubygems/rubygems/commit/75d9c0f1e4 --- lib/bundler/source/path.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index cdf871250a..3bb7fbfed5 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -226,7 +226,7 @@ module Bundler # Some gem authors put absolute paths in their gemspec # and we have to save them from themselves spec.files = spec.files.map do |path| - next path unless /\A#{Pathname::SEPARATOR_PAT}/.match?(path) + next path unless /\A#{Pathname::SEPARATOR_PAT}/o.match?(path) next if File.directory?(path) begin Pathname.new(path).relative_path_from(gem_dir).to_s -- cgit v1.2.3