I am trying to upgrade Ruby because I need to setup a Jekyll template, and I need to latest version to do it. Since I have a Mac running Sierra, I already have Ruby preinstalled as well as the Homebrew installation. When I install it using
brew install ruby
brew link --override ruby
After install go to directory with your code, run
rbenv install 2.3.1 and create file
2.3.1. All scripts running from this directory will use ruby 2.3.1.
Or you will able to set ruby version for all running scripts -
rbenv global 2.3.1