Ejemplo n.º 1
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);
        }