From b200695e3f43903a6ec3dade8a90c22db03b4b41 Mon Sep 17 00:00:00 2001 From: Stephen Sugden Date: Tue, 7 Jan 2025 12:26:52 +0100 Subject: [PATCH] Fix spec version comparison (#661) The return type of spec.version is a Gem::Version, which can be compared to a string, but not the other way around. --- lib/solargraph/yard_map.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/solargraph/yard_map.rb b/lib/solargraph/yard_map.rb index 89208a2bb..04be84aac 100755 --- a/lib/solargraph/yard_map.rb +++ b/lib/solargraph/yard_map.rb @@ -288,7 +288,7 @@ def spec_for_require path # Avoid loading the spec again if it's going to be skipped anyway return spec if @source_gems.include?(spec.name) # Avoid loading the spec again if it's already the correct version - if @gemset[spec.name] && @gemset[spec.name] != spec.version + if @gemset[spec.name] && spec.version != @gemset[spec.name] begin return Gem::Specification.find_by_name(spec.name, "= #{@gemset[spec.name]}") rescue Gem::LoadError