{:uriI"Ífile:///Users/himn1/dev/rails/engines/loco/lib/assets/javascripts/loco/base/identity_map.coffee?type=application/javascript&pipeline=self&id=f9629a1bd6cb1c8ef60a66fc39ae298cef459ec40689155bd3cfc3772a678146:ET:load_pathI"?/Users/himn1/dev/rails/engines/loco/lib/assets/javascripts;T: filenameI"]/Users/himn1/dev/rails/engines/loco/lib/assets/javascripts/loco/base/identity_map.coffee;T: nameI"loco/base/identity_map;T:logical_pathI"#loco/base/identity_map.self.js;T:content_typeI"application/javascript;T: sourceI"](function() { App.IdentityMap = (function() { function IdentityMap() {} IdentityMap.imap = {}; IdentityMap.clear = function() { return this.imap = {}; }; IdentityMap.add = function(obj) { var identity; identity = obj.getIdentity(); if (this.imap[identity] == null) { this.imap[identity] = {}; } if (this.imap[identity][obj.id] == null) { this.imap[identity][obj.id] = []; } return this.imap[identity][obj.id][0] = obj; }; IdentityMap.connect = function(obj, opts) { var model; if (opts == null) { opts = {}; } model = opts["with"]; this.add(model); return this.imap[model.getIdentity()][model.id].push(obj); }; IdentityMap.addCollection = function(identity, opts) { if (opts == null) { opts = {}; } if (this.imap[identity] == null) { this.imap[identity] = {}; } if (this.imap[identity]["collection"] == null) { this.imap[identity]["collection"] = []; } if (_.indexOf(this.imap[identity]["collection"], opts.to) !== -1) { return; } return this.imap[identity]["collection"].push(opts.to); }; IdentityMap.all = function(identity) { var arr, id, objs, ref; if (this.imap[identity] == null) { return null; } arr = []; ref = this.imap[identity]; for (id in ref) { objs = ref[id]; if (id === "collection") { continue; } arr.push(objs[0]); } return arr; }; IdentityMap.find = function(klass, id) { if (this.imap[klass] && this.imap[klass][id]) { return this.imap[klass][id][0]; } else { return null; } }; IdentityMap.findConnected = function(klass, id) { var arr; if (this.imap[klass] && this.imap[klass][id] && this.imap[klass][id].length > 1) { arr = this.imap[klass][id]; return arr.slice(1, +(arr.length - 1) + 1 || 9e9); } else { return []; } }; return IdentityMap; })(); }).call(this); ;T: metadata{ :dependencieso:Set: @hash{ I"environment-version;TTI"environment-paths;TTI"jprocessors:type=application/javascript&file_type=application/javascript&engines=.coffee&pipeline=self;TTI"kfile-digest:///Users/himn1/dev/rails/engines/loco/lib/assets/javascripts/loco/base/identity_map.coffee;TT: requiredo;;{: stubbedo;;{: linkso;;{: charsetI" utf-8;F: digest"%=aÉàû¥‘·