GemfileにRubyのVersionをベタ書きしない方法

GemfileにRubyのVersionをベタ書きしているプロジェクトがある。

rbenvでVersion管理を行っている場合、rbenv local 2.6.5と実行すると.ruby-versionというファイルが作られる。

$ cat .ruby-version 
2.6.5

そして、Gemfileで以下の記述するとGemfileにRubyのVersionをベタ書きしなくてよい。

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby RUBY_VERSION