Programmatically getting FULL Ruby version?

前端 未结 2 2049
执念已碎
执念已碎 2021-02-11 14:39

I know it\'s possible to get the Ruby version (e.g. \"1.9.3\") via the RUBY_VERSION constant. However, I want to know how to go about determining the exact version

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-11 15:02

    There is a RUBY_PATCHLEVEL constant as well. So you can get your version string as

    "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
    

提交回复
热议问题