diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2023-11-27 16:01:51 -0600 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-11-29 21:28:46 +0000 |
commit | 2927c280950924c0aaa6c1a5805b2978b177809e (patch) | |
tree | 41090a36a74303297f4c40a51c6b96720a28fade | |
parent | 8234763816eecd42da3b5e893cd236b64e6fc0fb (diff) |
[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
-rw-r--r-- | lib/bundler/source/path.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |