Object.subclass('Namespace', 'initializing', { initialize: function(context, nsName) { this.namespaceIdentifier = context.namespaceIdentifier + '.' + nsName; this.createTime = new Date(); }, }, 'accessing', { gather: function(selector, condition, recursive) { var result = Object.values(this).select(function(ea) { return condition.call(this, ea) }, this); if (!recursive) return result; return this.subNamespaces().inject(result, function(result, ns) { return result.concat(ns[selector](true)) }); }, subNamespaces: function(recursive) { return this.gather( 'subNamespaces', function(ea) { return (ea instanceof lively.lang.Namespace || ea === Global) && ea !== this }, recursive); }, classes: function(recursive) { var normalClasses = this.gather( 'classes', function(ea) { return ea && ea !== this.constructor && Class.isClass(ea) }, recursive); if (this === Global) return [Array, Number, String, Function].concat(normalClasses); return normalClasses; }, functions: function(recursive) { return this.gather( 'functions', function(ea) { return ea && !Class.isClass(ea) && Object.isFunction(ea) && !ea.declaredClass && this.requires !== ea && ea.getOriginal() === ea }, recursive); }, });
Defacer
SourceCode Defacer
X
M