TryGetClassVariable() публичный Метод

public TryGetClassVariable ( string name, object &value ) : bool
name string
value object
Результат 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);
        }