Sha256: a2ac0394eddea6a6617366e8d23e3d336efce06ae6868b9d6c872f6b4c40a816
Contents?: true
Size: 854 Bytes
Versions: 48
Compression:
Stored size: 854 Bytes
Contents
var composed, stampit, typeable, validations; validations = require('../validatable'); stampit = require('../../../vendor/stampit'); typeable = stampit({ validate_each: function(record, attribute, value) { this.type || (this.type = model[record.resource.toString()][attribute]); if (value) { if (value instanceof this.type) { this.type_name || (this.type_name = this.type.name); if (!value.valid) { return record.errors.add(attribute, 'type', { type_name: this.type_name != null }); } } else { throw new Error("Invalid attribute value type! Found " + (typeof value) + " expected " + this.type.name); } } } }); composed = stampit.compose(require('./validatorable'), typeable); composed.definition_key = 'validates_type_of'; module.exports = composed;
Version data entries
48 entries across 48 versions & 1 rubygems