Conversation
…rged" This reverts commit 4338633.
There was a problem hiding this comment.
Pull request overview
This PR attempts to skip loading lib/pathname.rb on Ruby 4.1+ (presumably because Pathname is fully provided elsewhere in those versions), by adding an early guard at the top of the file.
Changes:
- Add a Ruby-version guard intended to short-circuit
lib/pathname.rbon Ruby 4.1+.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return if RUBY_VERSION >= '4.1' | ||
|
|
There was a problem hiding this comment.
return at the top level of a required file is a syntax error in Ruby (invalid return in top-level context), so this change will prevent lib/pathname.rb from loading on all Ruby versions. If you need to skip the rest of the file for Ruby >= 4.1, wrap the remainder of the file in a conditional (if/unless) rather than using return.
| return if RUBY_VERSION >= '4.1' | ||
|
|
||
| unless RUBY_VERSION >= '4' |
There was a problem hiding this comment.
RUBY_VERSION is a string, so RUBY_VERSION >= '4.1' performs lexicographic comparison and can yield incorrect results for multi-digit segments (e.g., '4.10' vs '4.1'). Please use a numeric/semantic version comparison (e.g., Gem::Version, or comparing RUBY_VERSION.split('.').map(&:to_i) arrays) to make the guard correct for all future Ruby 4.x releases.
| return if RUBY_VERSION >= '4.1' | |
| unless RUBY_VERSION >= '4' | |
| ruby_version = RUBY_VERSION.split('.').map(&:to_i) | |
| return if ruby_version >= [4, 1] | |
| unless ruby_version >= [4] |
No description provided.