using System; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; using Ruby.Runtime; class Program { static void Main(string[] args) { try { new Program().Run(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } private void Run() { System.IO.File.WriteAllText("f.rb", @" module F def F.hello puts 'F:Hello' end end "); ExecuteStr("require 'f.rb'"); ExecuteStr("F.hello"); // IR SVN 107 fails here, IR SVN 103 prints 'F:Hello' } private ScriptRuntime _scriptRuntime; private ScriptScope _sharedScope; public ScriptRuntime ScriptRuntime { get { if (_scriptRuntime == null) { _scriptRuntime = ScriptRuntime.Create(); _scriptRuntime.GlobalOptions.DebugMode = true; } return _scriptRuntime; } } public ScriptEngine Engine { get { return ScriptRuntime.GetEngine(typeof(RubyContext)); } } public ScriptScope SharedScope { get { if (_sharedScope == null) _sharedScope = Engine.CreateScope(); return _sharedScope; } } public object ExecuteStr(string code) { return Engine.CreateScriptSourceFromString(code).Execute(SharedScope); } } // class