Don't use ActiveSupport methods and add a test to make sure this doesn't regress. Fixes #13559
Align the logic in `cleanup_portable_ruby` with that in `ruby.sh`. Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com> Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>