I want to get ruby version with patch number.
But RUBY_VERSION returns only first three numbers.
So I wrote like this:
`ruby -v`.gsub(/ruby (\d\.\d\.\dp\d+) .*\n/, $1)
But it's a little tricky. Is there any better way to do this?
The constant RUBY_PATCHLEVEL gives you the current patch level.
RUBY_VERSION
=> "2.0.0"
RUBY_PATCHLEVEL
=> 247
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With