R – How to automatically add dlls to ironruby engine

ironruby

I want to automatically add loaded dll of the current application into ironruby engine so that each time I execute a script I won't specify the "require" script anymore.

Thanks a lot.

Best Solution

I did this in September 2008 using ScriptRuntime.LoadAssembly. Here's my original code

// 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);
}
Related Question