InitializeModuleCopy() public method

public InitializeModuleCopy ( RubyModule module ) : void
module RubyModule
return 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);
        }