Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Inheritance test case passes, needs error case
  • Loading branch information
ranweiler committed Apr 11, 2013
1 parent a828382 commit 313df25
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions index.js
Expand Up @@ -4,10 +4,20 @@ var Seq = require('seq');
module.exports = {
patterns: {},
define: function(key, model, def) {
this.patterns[key] = {
class: model,
attributes: def
var _model, _def;
if (typeof(model) == 'string') {
// If 'model' is a string, interpret it as the name of a model that has
// already been defined. Try to inherit from that model.
_model = this.patterns[model].class;
_def = Hash.merge(this.patterns[model].attributes, def);
} else {
_model = model;
_def = def;
}
this.patterns[key] = {
class: _model,
attributes: _def
};
},
build: function(model, data, callback) {
if (typeof(data) == 'function'){
Expand Down

0 comments on commit 313df25

Please sign in to comment.