// TODO: public due to partial trust // implements Class#new public static object CreateAnonymousClass(RubyScope /*!*/ scope, BlockParam body, RubyClass /*!*/ self, [Optional] RubyClass superClass) { RubyContext ec = scope.RubyContext; RubyModule owner = scope.GetInnerMostModule(); // MRI is inconsistent here, it triggers "inherited" event after the body of the method is evaluated. // In all other cases the order is event first, body next. RubyClass newClass = ec.DefineClass(owner, null, superClass ?? ec.ObjectClass); return((body != null) ? RubyUtils.EvaluateInModule(newClass, body, newClass) : newClass); }