Assuming it's properly tested, I would simply run the tests that apply to the code in this directory with the versions of Ruby you're trying to ensure compatibility with.
If you're using GitHub Actions for CI, then you can create jobs for each version of Ruby you're trying to use. Then, ensure your default branch is protected, and set your branch protections only allows PRs to merge that pass CI.
This will also ensure that Ruby 3.x.x works with your current code, too. Some things have been deprecated, i.e. File#exists?
has been removed in favor of File#exist?
Also, this sounds like a good case of submodules, if this code is used for various projects.