{:uriI"file:///Users/himn1/dev/rails/engines/loco/lib/assets/javascripts/loco/base/identity_map.coffee?type=application/javascript&pipeline=self&id=426fc719b0cdf88873beb7a416121618e9571ab0548b1085e5d4603176145a25: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"Z(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 (this.imap[identity]["collection"].indexOf(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;TTF: requiredo;;}F: stubbedo;;}F: linkso;;}F: charsetI" utf-8;F: digest"%/oG--U$mNԴ`E: lengthiZ:dependencies_digest"%.]hj\fO`ik=1hmxg:idI"E426fc719b0cdf88873beb7a416121618e9571ab0548b1085e5d4603176145a25;F: mtimel+_;V