How to print Ruby's version from within the program

Is there a way to print the Ruby version from within a Ruby program?

I know i can use ruby -v at the command line, but what if it is inside
of the code and i want to print it out.

this is such as when in TextMate, i want the program to show whether it
is running under Ruby 1.8.2 or 1.8.6

···

--
Posted via http://www.ruby-forum.com/.

Alle giovedì 20 settembre 2007, SpringFlowers AutumnMoon ha scritto:

Is there a way to print the Ruby version from within a Ruby program?

I know i can use ruby -v at the command line, but what if it is inside
of the code and i want to print it out.

this is such as when in TextMate, i want the program to show whether it
is running under Ruby 1.8.2 or 1.8.6

puts RUBY_VERSION

Stefano

Is there a way to print the Ruby version from within a Ruby program?

>> RUBY_VERSION
=> "1.8.6"

this is such as when in TextMate, i want the program to show whether it
is running under Ruby 1.8.2 or 1.8.6

TextMate shows the version and location of the used Ruby interpreter above the program output.

James Edward Gray II

···

On Sep 20, 2007, at 7:46 AM, SpringFlowers AutumnMoon wrote:

patchlevel = " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
version = "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}#{patchlevel}) [#{RUBY_PLATFORM}]"

Is the string `ruby -v` prints out.

···

On Sep 20, 2007, at 05:46, SpringFlowers AutumnMoon wrote:

Is there a way to print the Ruby version from within a Ruby program?

I know i can use ruby -v at the command line, but what if it is inside
of the code and i want to print it out.

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars