現在のアプリケーションのロード済み dll を ironruby エンジンに自動的に追加して、スクリプトを実行するたびに "require" スクリプトを指定しなくて済むようにしたいと考えています。
どうもありがとう。
現在のアプリケーションのロード済み dll を ironruby エンジンに自動的に追加して、スクリプトを実行するたびに "require" スクリプトを指定しなくて済むようにしたいと考えています。
どうもありがとう。
2008 年 9 月にを使用してこれを行いましたScriptRuntime.LoadAssembly
。これが私の元のコードです
// this part may have changed, there's probably a different
// way to get the ScriptRuntime from the RubyEngine or somesuch
var runtime = new ScriptRuntime( Ruby.CreateRuntimeSetup() );
// give ruby access to all our assemblies
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
runtime.LoadAssembly(assembly);
}
スクリプト ファイルを 1 回だけロードするために、IronRuby.Ruby.RequireFile を使用できます。
たとえば、次の行は、標準ライブラリ フォルダーから CSV ライブラリを読み込みます。
IronRuby.Ruby.RequireFile(engine, @"D:\IronRuby\lib\ruby\1.8\csv.rb");
それが役に立てば幸い、
シェイ。