示例#1
0
        private static RubyModule /*!*/ SetVisibility(RubyScope /*!*/ scope, object /*!*/ self, object[] /*!*/ methodNames, RubyMethodAttributes attributes)
        {
            Assert.NotNull(scope, self, methodNames);
            RubyClass cls = scope.RubyContext.GetClassOf(self);

            ModuleOps.SetMethodAttributes(scope, cls, methodNames, attributes);
            return(cls);
        }
示例#2
0
            private object /*!*/ ReadExtended()
            {
                string     extensionName = ReadIdentifier();
                RubyModule module        = ReadClassOrModule('m', extensionName) as RubyModule;
                object     obj           = ReadAnObject(true);

                ModuleOps.ExtendObject(module, obj);
                return(obj);
            }
示例#3
0
        private static RubyModule /*!*/ SetVisibility(RubyScope /*!*/ scope, object /*!*/ self, string /*!*/[] /*!*/ methodNames, RubyMethodAttributes attributes)
        {
            Assert.NotNull(scope, self, methodNames);
            RubyModule module;

            // MRI: Method is searched in the class of self (Object), not in the main singleton class.
            // IronRuby specific: If we are in a top-level scope with redirected method lookup module we use that module (hosted scopes).
            var topScope = scope.Top.GlobalScope.TopLocalScope;

            if (scope == topScope && topScope.MethodLookupModule != null)
            {
                module = topScope.MethodLookupModule;
            }
            else
            {
                module = scope.RubyContext.GetClassOf(self);
            }
            ModuleOps.SetMethodAttributes(scope, module, methodNames, attributes);
            return(module);
        }
示例#4
0
 public static RubyArray /*!*/ GetGlobalConstants(RubyModule /*!*/ self)
 {
     return(ModuleOps.GetDefinedConstants(self.Context.ObjectClass));
 }