// implements Class#new public static object CreateAnonymousClass(RubyScope/*!*/ scope, BlockParam body, RubyClass/*!*/ self, [DefaultParameterValue(null)]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; }
public static MutableString GetAutoloadedConstantPath(RubyScope/*!*/ scope, object self, [DefaultProtocol, NotNull]string/*!*/ constantName) { return ModuleOps.GetAutoloadedConstantPath(scope.GetInnerMostModuleForConstantLookup(), constantName); }
public static void SetAutoloadedConstant(RubyScope/*!*/ scope, object self, [DefaultProtocol, NotNull]string/*!*/ constantName, [DefaultProtocol, NotNull]MutableString/*!*/ path) { ModuleOps.SetAutoloadedConstant(scope.GetInnerMostModuleForConstantLookup(), constantName, path); }
[Emitted] // ConstantVariable: public static object SetUnqualifiedConstant(object value, RubyScope/*!*/ scope, string/*!*/ name) { RubyUtils.SetConstant(scope.GetInnerMostModuleForConstantLookup(), name, value); return value; }
public static RubyModule/*!*/ DefineNestedClass(RubyScope/*!*/ scope, string/*!*/ name, object superClassObject) { return RubyUtils.DefineClass(scope.GlobalScope, scope.GetInnerMostModuleForConstantLookup(), name, superClassObject); }
public static RubyModule/*!*/ DefineNestedModule(RubyScope/*!*/ scope, string/*!*/ name) { return RubyUtils.DefineModule(scope.GlobalScope, scope.GetInnerMostModuleForConstantLookup(), name); }