Programmatically getting FULL Ruby version?

前端 未结 2 1368
小鲜肉
小鲜肉 2021-02-11 14:05

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 14:42

    At least in the newest Ruby (2.3.0), there is also a RUBY_DESCRIPTION constant:

    RUBY_DESCRIPTION
    # => "ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]"
    
    0 讨论(0)
  • 2021-02-11 15:08

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

    "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
    
    0 讨论(0)
提交回复
热议问题