Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Gem::Util.glob_files_in_dir
glob_files_in_dir(glob, base_path)
lib/rubygems/util.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/util.rb, line 85
def self.glob_files_in_dir(glob, base_path)
expanded_path = nil
Dir.glob(glob, base: base_path).map! do |f|
# File.join instead of File.expand_path, so that matched entries
# starting with `~` are not expanded into the home directory
File.join(expanded_path ||= File.expand_path(base_path), f)
end
end
Globs for entries matching glob inside of base_path, returning absolute paths to the matching files and directories. Unlike a plain Dir.glob with an interpolated path, glob metacharacters in base_path are not treated as part of the pattern. Matched entries are joined to base_path literally, so an entry starting with ‘~` is not expanded into a home directory, and no other normalization is applied to them.