rubyjruby

How can I tell if I'm running from JRuby vs. Ruby?


I have a script with a factory method that I would like to return a different implementation of some class depending on whether or not the script is running from JRuby or Ruby. Anyone have any ideas on how I could tell the difference from inside my script?

Some initial thoughts I had were:


Solution

  • I believe you can check the RUBY_PLATFORM constant.