public static object CreateAnonymousClass(RubyScope/*!*/ scope, BlockParam body, RubyClass/*!*/ self, [Optional]RubyClass superClass) {
RubyContext context = scope.RubyContext;
RubyModule owner = scope.GetInnerMostModuleForConstantLookup();
// 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 = context.DefineClass(owner, null, superClass ?? context.ObjectClass, null);
return (body != null) ? RubyUtils.EvaluateInModule(newClass, body, new[] { newClass }, newClass) : newClass;
}