End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Gem.find_latest_files
find_latest_files(glob, check_load_path=true)
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/rubygems.rb, line 525
def self.find_latest_files(glob, check_load_path=true)
files = []
files = find_files_from_load_path glob if check_load_path
files.concat Gem::Specification.latest_specs(true).map {|spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
}.flatten
# $LOAD_PATH might contain duplicate entries or reference
# the spec dirs directly, so we prune.
files.uniq! if check_load_path
return files
end
Returns a list of paths matching glob from the latest gems that can be used by a gem to pick up features from other gems. For example:
Example
Gem.find_latest_files('rdoc/discover').each do |path| load path end
if check_load_path is true (the default), then find_latest_files also searches $LOAD_PATH for files as well as gems.
Unlike find_files, find_latest_files will return only files from the latest version of a gem.
See also
.find_home
.find_spec_for_exe
.find_files
.find_unresolved_default_spec
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0