TryGetClassVariable() public method

public TryGetClassVariable ( string name, object &value ) : bool
name string
value object
return bool
示例#1
0
 public static object GetTaggedClasses(RubyModule/*!*/ self) {
     object taggedClasses;
     if (!self.TryGetClassVariable(_TaggedClasses, out taggedClasses)) {
         taggedClasses = CreateDefaultTagMapping(self.Context);
         self.SetClassVariable(_TaggedClasses, taggedClasses);                                
     }            
     return taggedClasses;
 }
示例#2
0
 public static Int32? GetBufferSize(RubyModule hpricotModule)
 {
     Object bufferSize;
     if (hpricotModule.TryGetClassVariable("@@buffer_size", out bufferSize)) {
         return (int)bufferSize;
     }
     return null;
 }
示例#3
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;
 }
示例#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 RemoveClassVariable(RubyModule /*!*/ self, [DefaultProtocol, NotNull] string /*!*/ variableName)
        {
            object value;

            if (!self.TryGetClassVariable(variableName, out value))
            {
                self.Context.CheckClassVariableName(variableName);
                throw RubyExceptions.CreateNameError("class variable {0} not defined for {1}", variableName, self.Name);
            }
            self.RemoveClassVariable(variableName);
            return(value);
        }