Determine ruby version from within Rails

后端 未结 4 1995
时光取名叫无心
时光取名叫无心 2020-12-07 19:46

Is there a way to determine what version of Ruby is running from within Rails (either on the web or through script/console)? I have Ruby 1.8.6 installed but I\'

4条回答
  •  -上瘾入骨i
    2020-12-07 20:19

    Use the Top-Level Constant

    RUBY_VERSION
    

    other useful Top-Level Constants are

    RUBY_PATCHLEVEL
    RUBY_PLATFORM
    RUBY_RELEASE_DATE
    

    here is an irb session:

    irb(main):001:0> RUBY_VERSION
    => "1.8.7"
    

提交回复
热议问题