Skip to content

Commit

Permalink
Use bootsnap's gemspec to determine availability (#269)
Browse files Browse the repository at this point in the history
Bootsnap has since dropped support for < 2.6.0, and supports up to 3.2

Use the actual Gem::Specification so this isn't hard-coded.
  • Loading branch information
alassek authored Jan 7, 2025
1 parent 42195c8 commit 8c4b454
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/dry/system/plugins/bootsnap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ def setup_bootsnap

# @api private
def bootsnap_available?
RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.3.0" && RUBY_VERSION < "3.1.0"
spec = Gem.loaded_specs["bootsnap"] or return false

RUBY_ENGINE == "ruby" &&
spec.match_platform(RUBY_PLATFORM) &&
spec.required_ruby_version.satisfied_by?(Gem::Version.new(RUBY_VERSION))
end
end
end
Expand Down

0 comments on commit 8c4b454

Please sign in to comment.