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

Version Path
spontaneous-0.1.0.alpha1 application/js/vendor/JS.Class-2.1.5/src/constant_scope.js
acts_as_dashboard-0.4.1 generators/dashboard/templates/js.class-2.1.4/src/constant_scope.js
acts_as_dashboard-0.4.0 generators/dashboard/templates/js.class-2.1.4/src/constant_scope.js
acts_as_dashboard-0.3.3 generators/dashboard/templates/js.class-2.1.4/src/constant_scope.js
acts_as_dashboard-0.3.2 generators/dashboard/templates/js.class-2.1.4/src/constant_scope.js
acts_as_dashboard-0.3.0 generators/dashboard/templates/js.class-2.1.4/src/constant_scope.js
acts_as_dashboard-0.1.0 generators/dashboard/templates/js.class-2.1.4/src/constant_scope.js