예제 #1
0
        // dynamic dispatch to "const_missing" if not found
        public object ResolveConstant(bool autoload, string /*!*/ name)
        {
            object result;

            if (TryResolveConstant(autoload, name, out result))
            {
                return(result);
            }

            RubyUtils.CheckConstantName(name);
            return(RubySites.ModuleConstMissing(RubyContext, GetInnerMostModule(), name));
        }
예제 #2
0
        public static object GetConstant(RubyScope /*!*/ scope, RubyModule /*!*/ owner, string /*!*/ name, bool lookupObject)
        {
            Assert.NotNull(scope, owner, name);

            object result;

            if (owner.TryResolveConstant(scope.GlobalScope, name, out result))
            {
                return(result);
            }

            RubyClass objectClass = owner.Context.ObjectClass;

            if (owner != objectClass && lookupObject && objectClass.TryResolveConstant(scope.GlobalScope, name, out result))
            {
                return(result);
            }

            CheckConstantName(name);
            return(RubySites.ModuleConstMissing(scope.RubyContext, owner, name));
        }