I would install rbenv to manage your environment
Install rbenv with your system package manager first
apt install rbenv
Make sure that rbenv is up to date by pulling the latest version from GitHub
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
List available versions
rbenv install -l
Install
rbenv install 3.2.0