Skip to content

Commit

Permalink
Fix spec version comparison (#661)
Browse files Browse the repository at this point in the history
The return type of spec.version is a Gem::Version, which can be compared to a string, but not the other way around.
  • Loading branch information
grncdr authored Jan 7, 2025
1 parent d8e70dc commit b200695
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/solargraph/yard_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b200695

Please sign in to comment.