js-core-data
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -53,3 +53,7 @@ // Generated by CoffeeScript 1.6.3 | ||
EntityDescription.prototype.objectClass = function() { | ||
var e, _m; | ||
var cls, e, _m; | ||
if (this._objectClass) { | ||
return this._objectClass; | ||
} | ||
cls = null; | ||
if (this.objectClassName) { | ||
@@ -59,3 +63,3 @@ _m = module.parent; | ||
try { | ||
return require(path.dirname(_m.filename) + this.objectClassName); | ||
cls = require(path.dirname(_m.filename) + this.objectClassName); | ||
} catch (_error) { | ||
@@ -70,4 +74,9 @@ e = _error; | ||
} else { | ||
return ManagedObject; | ||
cls = ManagedObject; | ||
} | ||
if (!cls) { | ||
throw new Error('module for class ' + this.name + ' not found'); | ||
} | ||
this._objectClass = cls; | ||
return cls; | ||
}; | ||
@@ -74,0 +83,0 @@ |
@@ -55,2 +55,3 @@ // Generated by CoffeeScript 1.6.3 | ||
entity.objectClassName = info["class"]; | ||
entity.objectClass(); | ||
} | ||
@@ -57,0 +58,0 @@ entities[entityName] = entity; |
{ | ||
"name": "js-core-data", | ||
"description": "ORM inspired by Apple's Objective-C CoreData", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"dependencies":{ | ||
@@ -6,0 +6,0 @@ "moment":"x", |
@@ -27,2 +27,7 @@ var assert = require("assert"), | ||
}) | ||
it('should throw error if no custom file module found',function(){ | ||
assert.throws(function(){ | ||
var model = new ManagedObjectModel(__dirname + '/schemes/car-model-custom-classes-invalid.yaml'); | ||
}) | ||
}) | ||
it('should create object with valid class',function(){ | ||
@@ -29,0 +34,0 @@ assert.ok(car instanceof Car) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8176689
295
105889