InitializeModuleCopy() public method

public InitializeModuleCopy ( RubyModule module ) : void
module RubyModule
return void
コード例 #1
0
ファイル: ModuleOps.cs プロジェクト: atczyc/ironruby
        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);
        }