From: Robert Klemme Date: 2007-07-17T02:45:04+09:00 Subject: Re: How can I get the Ruby version from within a Ruby script? On 16.07.2007 19:16, Paul wrote: > On Jul 16, 11:13 am, Phil Meier wrote: >> Just use constant RUBY_VERSION. >> >> puts RUBY_VERSION >> => 1.8.6 > > That's perfect! Thank you. > > I don't know why Google didn't turn that up anywhere. I even checked > the Pickaxe book but I didn't find it under "V" for 'version'. Since the version is a good candidate for a constant you can try this: Robert@Babelfish2 ~ $ ruby -e 'Object.constants.sort.each {|c| cv=Object.const_get(c); print c, "=", cv, "\n" unless Module === cv}' ARGF=ARGF ARGV= ENV=ENV FALSE=false NIL=nil PLATFORM=i386-cygwin RELEASE_DATE=2007-03-13 RUBY_PATCHLEVEL=0 RUBY_PLATFORM=i386-cygwin RUBY_RELEASE_DATE=2007-03-13 RUBY_VERSION=1.8.6 STDERR=# STDIN=# STDOUT=# TOPLEVEL_BINDING=# TRUE=true VERSION=1.8.6 Robert@Babelfish2 ~ $ Or just use IRB. Kind regards robert