The RUBY_VERSION constant contains the version number of the ruby interpreter and RUBY_PATCHLEVEL contains the patchlevel, so this:
puts RUBY_VERSION
outputs e.g. 2.2.3, while this:
puts RUBY_PATCHLEVEL
outputs e.g. 173. Together it can be used like this:
ruby -e 'print "ruby #{ RUBY_VERSION }p#{ RUBY_PATCHLEVEL }"'
to output e.g. ruby 2.2.3p173