What values for RUBY_ENGINE correspond to which Ruby implementations?
Asked Answered
B

2

12

The method I know of to detect the Ruby implementation (e.g., MRI, JRuby, Rubinius, etc.) at run time is to check the global constant RUBY_ENGINE:

$ ruby -e 'puts RUBY_ENGINE'
ruby

What's a reasonably comprehensive list of known Ruby implementations and their corresponding values for RUBY_ENGINE?

Bohon answered 27/3, 2012 at 16:58 Comment(0)
B
21

Here's what I've found so far:

| RUBY_ENGINE | Implementation    |
|:-----------:|:------------------|
| <undefined> | MRI < 1.9         |
| 'ruby'      | MRI >= 1.9 or REE |
| 'jruby'     | JRuby             |
| 'macruby'   | MacRuby           |
| 'rbx'       | Rubinius          |
| 'maglev'    | MagLev            |
| 'ironruby'  | IronRuby          |
| 'cardinal'  | Cardinal          |

Links for the above mentioned Ruby implementations:

Props to Ujihisa for this blog entry which had most values. Others were found by reading this and this. Still more values have been gathered from other answers here on StackOverflow. More props to everyone who has contributed!

Bohon answered 27/3, 2012 at 17:2 Comment(0)
C
2

Also:

| RUBY_ENGINE | Implementation    |
|:-----------:|:------------------|
| "ruby"      | REE               |
| "maglev"    | MagLev            |
Conceptionconceptual answered 28/3, 2012 at 8:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.