Code coverage report for lib/template/view/reference.js

Statements: 30.77% (4 / 13)      Branches: 0% (0 / 6)      Functions: 0% (0 / 3)      Lines: 33.33% (4 / 12)      Ignored: none     

All files » lib/template/view/ » reference.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 421         1                   1                                                 1  
var protoclass = require("protoclass");
 
/**
 */
 
function Reference(view, path, settable, gettable) {
  this.view     = view;
  this.path     = path;
  this.settable = settable !== false;
  this.gettable = gettable !== false;
}
 
/**
 */
 
protoclass(Reference, {
 
  /**
   */
 
  __isReference: true,
 
  /**
   */
 
  value: function(value) {
    if (!arguments.length) {
      return this.gettable ? this.view.get(this.path) : void 0;
    }
    if (this.settable) this.view.set(this.path, value);
  },
 
  /**
   */
 
  toString: function() {
    return this.view.get(this.path);
  }
});
 
module.exports = Reference;