Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::QueryUtils#installed?
installed?(name, req = Gem::Requirement.default)
lib/rubygems/query_utils.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/query_utils.rb, line 183
def installed?(name, req = Gem::Requirement.default)
Gem::Specification.any? {|s| s.name =~ name && req =~ s.version }
end
Check if gem name version version is installed.
See also
#gem_name?
#make_entry
#execute
#output_query_results
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0