On Sun, Apr 3, 2011 at 9:08 PM, Trejkaz [email protected] wrote:
I found this documented in the Wiki:
JRubyScriptEngineManager manager = new JRubyScriptEngineManager();
JRubyEngine engine = (JRubyEngine) manager.getEngineByName(“jruby”);
This is handy, but I was wondering if it’s possible to set this on a
script by script basis.
Before, it was possible but not now. Because, JRuby works with not
just the script users write. For example, JRuby needs one of two sets
of Ruby code for a built-in library. If you see JRuby’s lib/ruby
directory, you’ll find 1.8 and 1.9 directories and hundreds of(?) Ruby
code in those directories. When JRuby instantiates Ruby runtime, one
set of them is loaded on the runtime. When those days that version
change was possible, JRuby worked using 1.8 library and 1.9 grammar or
vise versa, or 1.8 and 1.9 libraries were mixed on the same runtime.
That might have ended up in unexpected results. This is why version
must be specified before Ruby runtime is instantiated and never be
changed after the instantiation.