You can switch Ruby version temporarily with rbenv local
But it'd need to be switched back after you're done. Specially for a single command it's kind of pain. In those cases, you can use RBENV_VERSION env variable.
RBENV_VERSION=2.6.3 ruby -v
This might be useful in a shell script or so.
From us to your inbox weekly.