public bool EnumerateConstants(Func<RubyModule, string, object, bool>/*!*/ action) {
Context.RequiresClassHierarchyLock();
InitializeConstantsNoLock();
foreach (var constant in _constants) {
var name = constant.Key;
var storage = constant.Value;
if (!storage.IsRemoved && action(this, name, storage.Value)) {
return true;
}
}
if (_namespaceTracker != null) {
foreach (KeyValuePair<string, object> constant in _namespaceTracker) {
string name = constant.Key;
// we check if we haven't already yielded the value so that we don't yield values hidden by a user defined constant:
if (!_constants.ContainsKey(name) && action(this, name, constant.Value)) {
return true;
}
}
}
return false;
}