which Ruby is in use?

H

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,
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

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"
 
Q

Quintus

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,

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

Vale,
Marvin
 
H

Hassan Schroeder

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.
 
A

Adam Prescott

[Note: parts of this message were removed to make it a legal post.]

On Thu, Jan 27, 2011 at 5:30 PM, Hassan Schroeder <
Ah, that's it -- I know I've seen that before, but couldn't dredge it out
of the musty corners -- thanks much! :)

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)}" }'
 
H

Hassan Schroeder

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)}" }'

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

Josh Cheek

[Note: parts of this message were removed to make it a legal post.]

On Thu, Jan 27, 2011 at 11:14 AM, 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.
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

No worries. Here's how I found it:

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

Then I tried a few of the results. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,813
Members
47,357
Latest member
sitele8746

Latest Threads

Top