Inheritance: IDynamicObject
Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 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);
 }