Thanks Peter, I really appreciate it.
On Sun, Sep 28, 2008 at 3:55 PM, Peter Bacon Darwin
<[EMAIL PROTECTED]> wrote:
> And if you want the monkey patching to work then this should help...
>
> In RubyModule.cs you need:
>
> // Ruby constructor:
> public static RubyModule/*!*/
> CreateAnonymousModule([NotNull]BlockParam/*!*/ block, RubyClass/*!*/ self) {
> RubyModule module =
> self.ExecutionContext.DefineModule(SymbolId.Empty);
> object returnedValue =
> RubySites.ModuleEval(block.Proc.LocalScope, module, block.Proc);
> if ( block.BlockJumped(returnedValue) ) {
> return null;
> }
> return module;
> }
>
> And in RubySites.cs you need:
>
> private static readonly CallSite<Func<CallSite, CodeContext,
> RubyModule, Proc, object>> ModuleEvalSharedSite = CallSite<Func<CallSite,
> CodeContext, RubyModule, Proc, object>>.Create(
> InstanceCallAction("module_eval",
> RubyCallSignature.WithBlock(0)));
>
> public static object ModuleEval(CodeContext context, RubyModule
> self, Proc block) {
> return ModuleEvalSharedSite.Target(ModuleEvalSharedSite,
> context, self, block);
> }
>
> There are probably a number of corner cases that I have missed but this
> should work for the majority of uses.
>
> Regards,
> Pete
>
> _______________________________________________
> Ironruby-core mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core