Sha256: 8b6b823191538a3c95bf249ab5ac8c5f8c494515c00f278e8da46922dbddf5d3
Contents?: true
Size: 967 Bytes
Versions: 58
Compression:
Stored size: 967 Bytes
Contents
pageflow.FileTypesCollection = pageflow.Object.extend({ initialize: function(fileTypes) { this._fileTypes = fileTypes; }, findByUpload: function(upload) { var result = this.find(function(fileType) { return fileType.matchUpload(upload); }); if (!result) { throw(new pageflow.UnmatchedUploadError(upload)); } return result; }, findByCollectionName: function(collectionName) { var result = this.find(function(fileType) { return fileType.collectionName === collectionName; }); if (!result) { throw('Could not find file type by collection name "' + collectionName +'"'); } return result; } }); _.each(['each', 'map', 'reduce', 'first', 'find', 'contains', 'filter'], function(method) { pageflow.FileTypesCollection.prototype[method] = function() { var args = Array.prototype.slice.call(arguments); args.unshift(this._fileTypes); return _[method].apply(_, args); }; });
Version data entries
58 entries across 58 versions & 1 rubygems