InitializeModuleCopy() публичный Метод

public InitializeModuleCopy ( RubyModule module ) : void
module RubyModule
Результат void
Пример #1
0
        public static RubyModule/*!*/ InitializeCopy(RubyModule/*!*/ self, object other) {
            // no class can be reinitialized:
            if (self.IsClass) {
                throw RubyExceptions.CreateTypeError("already initialized class");
            }
            
            // self could be a meta-module:
            RubyClass selfClass = self.Context.GetClassOf(self);
            RubyClass otherClass = self.Context.GetClassOf(other);
            if (otherClass != selfClass) {
                throw RubyExceptions.CreateTypeError("initialize_copy should take same class object");
            }

            self.InitializeModuleCopy((RubyModule)other);
            return self;
        }
Пример #2
0
        public static RubyModule /*!*/ InitializeCopy(RubyModule /*!*/ self, object other)
        {
            // no class can be reinitialized:
            if (self.IsClass)
            {
                throw RubyExceptions.CreateTypeError("already initialized class");
            }

            // self could be a meta-module:
            RubyClass selfClass  = self.Context.GetClassOf(self);
            RubyClass otherClass = self.Context.GetClassOf(other);

            if (otherClass != selfClass)
            {
                throw RubyExceptions.CreateTypeError("initialize_copy should take same class object");
            }

            self.InitializeModuleCopy((RubyModule)other);
            return(self);
        }