Print version from the command line:
Print version from within a script:
# -*- coding: utf-8 -*- # Ruby p RUBY_VERSION # "2.0.0"
Printing version from script is a important technique to find out which version your script is running. Because, you might have several version installed, and in terminal, there are aliases, links, path environment variables, various shell init scripts, that effect which Ruby version will start when you type
ruby in shell.
See: Ruby Version Release Dates.