brew install ruby 2.7.1 code example
Example 1: brew update ruby
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 2.7.0
$ rbenv global 2.7.0
Example 2: brew install ruby
brew install ruby
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 2.7.0
$ rbenv global 2.7.0
brew install ruby