function () { var obj; function Ctor (arg) { this.foo = arg; } obj = utils.instantiate(Ctor, ['foo']); obj.should.be.an.instanceof(Ctor); obj.should.have.property('foo', 'foo'); }
//------------------------------------------------------------------------------ // Internal Types //------------------------------------------------------------------------------ /** * @typedef PatternJGLEvaluatorHandler~Action * @type {Function} * @param {Array<Array<Integer|String>>} query * @param {Mixed} [value] * @returns {Rx.Observable<module:JGLEvaluator~PathValue>} */ /** * @typedef PatternJGLEvaluatorHandler~Method * @type {PatternJGLEvaluatorHandler.GET|PatternJGLEvaluatorHandler.SET|PatternJGLEvaluatorHandler.DEL} */ //------------------------------------------------------------------------------ // Constructor //------------------------------------------------------------------------------ /** * @class PatternJGLEvaluatorHandler * @param {PatternJGLEvaluatorHandler~Method} method * @param {PatternJGLEvaluatorParser~Pattern} pattern * @param {PatternJGLEvaluatorHandler~Action} action */ function JGLEvaluatorHandler (method, pattern, action) { this.method = method.toLowerCase(); this.pattern = pattern; this.parser = protean.instantiate(Parser, pattern); this.run = action; }