IronRuby.Builtins.RubyModule.ForEachClassVariable C# (CSharp) Метод

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

public ForEachClassVariable ( bool inherited, Func action ) : void
inherited bool
action Func
Результат void
        public void ForEachClassVariable(bool inherited, Func<RubyModule, string, object, bool>/*!*/ action) {
            Context.RequiresClassHierarchyLock();

            ForEachAncestor(inherited, delegate(RubyModule/*!*/ module) {
                // notification that we entered the module (it could have no class variable):
                if (action(module, null, Missing.Value)) return true;

                return module.EnumerateClassVariables(action);
            });
        }

Usage Example

Пример #1
0
        public static RubyArray /*!*/ ClassVariables(RubyModule /*!*/ self)
        {
            var visited = new Dictionary <string, bool>();
            var result  = new RubyArray();

            self.ForEachClassVariable(true, delegate(RubyModule /*!*/ module, string name, object value) {
                if (name != null && !visited.ContainsKey(name))
                {
                    result.Add(MutableString.Create(name));
                    visited.Add(name, true);
                }
                return(false);
            });
            return(result);
        }
All Usage Examples Of IronRuby.Builtins.RubyModule::ForEachClassVariable
RubyModule