extract ruby version logic into RubyVersion