예제 #1
0
        public static bool ClassVariableDefined(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ variableName)
        {
            RubyUtils.CheckClassVariableName(variableName);
            object value;

            return(self.TryResolveClassVariable(variableName, out value) != null);
        }
예제 #2
0
        public static object GetClassVariable(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ variableName)
        {
            object value;

            if (self.TryResolveClassVariable(variableName, out value) == null)
            {
                RubyUtils.CheckClassVariableName(variableName);
                throw RubyExceptions.CreateNameError(String.Format("uninitialized class variable `{0}' in `{1}'", variableName, self.Name));
            }
            return(value);
        }
예제 #3
0
        public static bool IsClassVariableDefined(RubyModule /*!*/ self, [DefaultProtocol, NotNull] string /*!*/ variableName)
        {
            object value;

            if (self.TryResolveClassVariable(variableName, out value) == null)
            {
                RubyUtils.CheckClassVariableName(variableName);
                return(false);
            }
            return(true);
        }
예제 #4
0
        public static object RemoveClassVariable(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ variableName)
        {
            object value;

            if (!self.TryGetClassVariable(variableName, out value))
            {
                RubyUtils.CheckClassVariableName(variableName);
                throw RubyExceptions.CreateNameError(String.Format("class variable `{0}' not defined for `{1}'", variableName, self.Name));
            }
            self.RemoveClassVariable(variableName);
            return(value);
        }
예제 #5
0
 public static object ClassVariableSet(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ variableName, object value)
 {
     RubyUtils.CheckClassVariableName(variableName);
     self.SetClassVariable(variableName, value);
     return(value);
 }