The running Ruby version can be listed with the RUBY_VERSION constant.
RUBY_VERSION
For instance, if my Ruby version is 3.0.0, then I could get the version like so:
> RUBY_VERSION => "3.0.0"
This is nice if you just want to check in an IRB session or if you need it as part of a script.
sourcearrow-up-right
Last updated 4 years ago