Sha256: 78638b65e83f539b63c22adacfa6a715666e0d2cbbdb961b36310befa8f8c3d1
Contents?: true
Size: 1011 Bytes
Versions: 6
Compression:
Stored size: 1011 Bytes
Contents
var would = function(action){ var result; result = {} result.action = action; result.go = function(){ this.action.apply(null,this.args); } result.with = function(){ this.args = arguments; return this; } result.when = function(condition_or_conditions){ if(condition_or_conditions.conditions){ condition_or_conditions.action = this.action; condition_or_conditions.action_args = this.args; return condition_or_conditions; } this.condition = condition_or_conditions; this.pass = function(){ if(this.condition()){ this.action.apply(null,this.args); } } this.not_pass = function(){ if(!this.condition()){ this.action.apply(null,this.args); } } return this; }; return result; } var not = function(condition){ return function(){ return !condition(); } }
Version data entries
6 entries across 6 versions & 2 rubygems