public RubyGlobalScope(RubyContext/*!*/ context, Scope/*!*/ scope, RubyObject/*!*/ mainObject, bool isHosted) : base(scope) { Assert.NotNull(context, scope, mainObject); Debug.Assert(mainObject.ImmediateClass.IsSingletonClass); _context = context; _mainObject = mainObject; _isHosted = isHosted; }
protected object /*!*/ DefineSingleton(Action <RubyModule> instanceTrait, Action <RubyModule> classTrait, Action <RubyModule> constantsInitializer, params RubyModule /*!*/[] /*!*/ mixins) { Assert.NotNullItems(mixins); Debug.Assert(_context.ObjectClass != null); RubyModule[] expandedMixins; using (_context.ClassHierarchyLocker()) { expandedMixins = RubyModule.ExpandMixinsNoLock(_context.ObjectClass, mixins); } object result = new RubyObject(_context.ObjectClass); _context.GetOrCreateInstanceSingleton(result, instanceTrait, classTrait, constantsInitializer, expandedMixins); return(result); }
internal static RubyTopLevelScope/*!*/ CreateWrappedTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context) { RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false, false); RubyModule module = context.CreateModule(null, null, null, null, null, null, null, ModuleRestrictions.None); RubyObject mainObject = new RubyObject(context.ObjectClass); context.CreateMainSingleton(mainObject, new[] { module }); RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, module, null, mainObject); scope.SetDebugName("top-level-wrapped"); return scope; }
internal RubyTopLevelScope(RubyGlobalScope/*!*/ globalScope, RubyModule scopeModule, RubyModule methodLookupModule, RubyObject/*!*/ selfObject) { Assert.NotNull(globalScope, selfObject); // RubyScope: _top = this; _selfObject = selfObject; _methodAttributes = RubyMethodAttributes.PrivateInstance; // RubyTopLevelScope: _globalScope = globalScope; _context = globalScope.Context; _wrappingModule = scopeModule; _methodLookupModule = methodLookupModule; }
protected object/*!*/ DefineSingleton(Action<RubyModule> instanceTrait, Action<RubyModule> classTrait, Action<RubyModule> constantsInitializer, params RubyModule/*!*/[]/*!*/ mixins) { Assert.NotNullItems(mixins); Debug.Assert(_context.ObjectClass != null); RubyModule[] expandedMixins; using (_context.ClassHierarchyLocker()) { expandedMixins = RubyModule.ExpandMixinsNoLock(_context.ObjectClass, mixins); } object result = new RubyObject(_context.ObjectClass); _context.GetOrCreateInstanceSingleton(result, instanceTrait, classTrait, constantsInitializer, expandedMixins); return result; }
internal RubyTopLevelScope(RubyGlobalScope/*!*/ globalScope, RubyModule scopeModule, RubyModule methodLookupModule, RuntimeFlowControl/*!*/ runtimeFlowControl, RubyObject/*!*/ selfObject) : base(runtimeFlowControl, selfObject) { Assert.NotNull(globalScope, selfObject); _globalScope = globalScope; _context = globalScope.Context; _wrappingModule = scopeModule; _methodLookupModule = methodLookupModule; }
public static void SetEncoding(ConversionStorage<IDictionary<object, object>>/*!*/ toHash, ConversionStorage<MutableString>/*!*/ toStr, RubyObject self, object external, [Optional]object @internal, [Optional]IDictionary<object, object> options) { RubyIOOps.SetEncodings(toHash, toStr, self.ImmediateClass.Context.InputProvider.GetCurrentStream(), external, @internal, options); }
public static void SetEncoding(ConversionStorage <IDictionary <object, object> > /*!*/ toHash, ConversionStorage <MutableString> /*!*/ toStr, RubyObject self, object external, [Optional] object @internal, [Optional] IDictionary <object, object> options) { RubyIOOps.SetEncodings(toHash, toStr, self.ImmediateClass.Context.InputProvider.GetCurrentStream(), external, @internal, options); }