Sha256: 3bc8cc274b35b8fc2d536da681649e928cc599c4bebba04006673bb55c41d646
Contents?: true
Size: 1.29 KB
Versions: 7
Compression:
Stored size: 1.29 KB
Contents
JS.ConstantScope = new JS.Module('ConstantScope', { extend: { included: function(base) { base.__consts__ = new JS.Module(); base.extend(this.ClassMethods); base.include(base.__consts__); base.extend(base.__consts__); base.include(base.__mod__.__fns__); base.extend(base.__eigen__().__fns__); }, ClassMethods: new JS.Module({ extend: function() { var constants = JS.ConstantScope.extract(arguments[0], this); this.__consts__.include(constants); this.callSuper(); }, include: function() { var constants = JS.ConstantScope.extract(arguments[0], this); this.__consts__.include(constants); this.callSuper(); } }), extract: function(inclusions, base) { if (!inclusions) return null; if (JS.isType(inclusions, JS.Module)) return null; var constants = {}, key, object; for (key in inclusions) { if (!/^[A-Z]/.test(key)) continue; object = inclusions[key]; constants[key] = object; delete inclusions[key]; if (JS.isType(object, JS.Module)) { object.include(this); object.__consts__.include(base.__consts__); } } return constants; } } });
Version data entries
7 entries across 7 versions & 2 rubygems