public static bool ClassVariableDefined(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ variableName) { RubyUtils.CheckClassVariableName(variableName); object value; return(self.TryResolveClassVariable(variableName, out value) != null); }
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); }
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); }
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); }
public static object ClassVariableSet(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ variableName, object value) { RubyUtils.CheckClassVariableName(variableName); self.SetClassVariable(variableName, value); return(value); }