Which Ruby is in use?

How can I tell from within a running program which interpreter is being
used -- i.e. MRI, REE, etc.?

RUBY_VERSION only returns a number, .e.g. "1.8.7".

TIA,

···

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

RUBY_DESCRIPTION will give you something like this:

ruby-1.9.2-p0 > RUBY_DESCRIPTION
=> "ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]"
ree-1.8.7-2010.02 > RUBY_DESCRIPTION
=> "ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI
0x6770, Ruby Enterprise Edition 2010.02"

The RUBY_ENGINE constant should define this, but I'm not sure wheather
it's already in 1.8.

Vale,
Marvin

···

Am 27.01.2011 18:14, schrieb Hassan Schroeder:

How can I tell from within a running program which interpreter is being
used -- i.e. MRI, REE, etc.?

RUBY_VERSION only returns a number, .e.g. "1.8.7".

TIA,

If you're using RVM, there is also some good stuff in the ENV hash.

···

On Thu, Jan 27, 2011 at 11:14 AM, Hassan Schroeder < hassan.schroeder@gmail.com> wrote:

How can I tell from within a running program which interpreter is being
used -- i.e. MRI, REE, etc.?

RUBY_VERSION only returns a number, .e.g. "1.8.7".

TIA,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

Ah, that's it -- I know I've seen that before, but couldn't dredge it out
of the musty corners -- thanks much! :slight_smile:

···

On Thu, Jan 27, 2011 at 9:23 AM, Steve Klabnik <steve@steveklabnik.com> wrote:

RUBY_DESCRIPTION

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

The RUBY_ENGINE constant should define this, but I'm not sure wheather
it's already in 1.8.

That doesn't appear to be defined in at least this Mac's MRI 1.8.7.

RUBY_VERSION

=> "1.8.7"

RUBY_DESCRIPTION

=> "ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]"

RUBY_ENGINE

NameError: uninitialized constant RUBY_ENGINE

Thanks for pointing it out, though.

···

On Thu, Jan 27, 2011 at 10:05 AM, Quintus <sutniuq@gmx.net> wrote:
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

You might find Object.constants.grep(/RUBY/) useful to remind yourself.

$ ruby -e 'Object.constants.grep(/RUBY/).each { |c| puts "#{c} =>
#{Object.const_get(c)}" }'

···

On Thu, Jan 27, 2011 at 5:30 PM, Hassan Schroeder < hassan.schroeder@gmail.com> wrote:

Ah, that's it -- I know I've seen that before, but couldn't dredge it out
of the musty corners -- thanks much! :slight_smile:

No worries. Here's how I found it:

irb
RUBY_<tab><tab><tab><tab>

Then I tried a few of the results. :slight_smile:

D'oh! Thanks for the reminder. Apparently I needed a lot more coffee
this morning...

···

On Thu, Jan 27, 2011 at 12:32 PM, Adam Prescott <mentionuse@gmail.com> wrote:

You might find Object.constants.grep(/RUBY/) useful to remind yourself.

$ ruby -e 'Object.constants.grep(/RUBY/).each { |c| puts "#{c} =>
#{Object.const_get(c)}" }'

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan