brew upgrade ruby 2.5 code example
Example: brew update ruby
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 2.7.0
$ rbenv global 2.7.0
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 2.7.0
$ rbenv global 2.7.0