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,

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”

On Thu, Jan 27, 2011 at 9:23 AM, Steve K. [email protected]
wrote:

RUBY_DESCRIPTION

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:

Am 27.01.2011 18:14, schrieb Hassan S.:

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,

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

Vale,
Marvin

On Thu, Jan 27, 2011 at 10:05 AM, Quintus [email protected] wrote:

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 12:32 PM, Adam P. [email protected]
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©}” }’

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

On Thu, Jan 27, 2011 at 5:30 PM, Hassan S. <
[email protected]> 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:

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

$ ruby -e ‘Object.constants.grep(/RUBY/).each { |c| puts “#{c} =>
#{Object.const_get©}” }’

On Thu, Jan 27, 2011 at 11:14 AM, Hassan S. <
[email protected]> wrote:

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

No worries. Here’s how I found it:

irb
RUBY_

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs