Sha256: 1c05cb7d4f84b443508f39a20edabb700eccfbcbc8ba911d15ab6b6daf17dc6e

Contents?: true

Size: 1.59 KB

Versions: 27

Compression:

Stored size: 1.59 KB

Contents

<dom-module id="cell-dresser">
  <template>
    <style>
      

      /*# sourceMappingURL=style.css.map */

    </style>


  </template>
  <script>
    Polymer({
      is: 'cell-dresser',
      getRule: function(cell, isHeader, attire) {
        if ((attire == null) || !attire.enabled) {
          return;
        }
        return attire != null ? attire.rules.filter((function(_this) {
          return function(rule) {
            return _this._doesSatisfyRule(cell, isHeader, rule);
          };
        })(this))[0] : void 0;
      },
      _doesSatisfyRule: function(cell, isHeader, rule) {
        var itSatisfies;
        itSatisfies = (function(_this) {
          return function(color) {
            return _this._doesSatisfyQuantity(cell[color], rule.when[color]) && _this._doesSatisfyHeader(isHeader, rule.when.head);
          };
        })(this);
        return ["red", "blue", "green", "black"].reduce((function(_this) {
          return function(previousCondition, color) {
            return previousCondition && itSatisfies(color);
          };
        })(this), true);
      },
      _doesSatisfyQuantity: function(quantity, expectedQuantity) {
        if (quantity == null) {
          quantity = 0;
        }
        switch (expectedQuantity) {
          case "*":
            return true;
          case "+":
            return quantity > 0;
          default:
            return quantity === expectedQuantity;
        }
      },
      _doesSatisfyHeader: function(isHeader, expectedHeader) {
        return (expectedHeader == null) || expectedHeader === isHeader;
      }
    });

  </script>
</dom-module>

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mumuki-gobstones-board-1.20.1 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.19.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.18.1 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.18.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.17.2 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.17.1 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.17.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.16.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.15.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.14.2 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.14.1 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.14.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.13.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.12.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.11.1 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.11.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.10.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.9.0 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.8.14 app/assets/htmls/components/cell-dresser.html
gobstones-board-1.8.13 app/assets/htmls/components/cell-dresser.html