o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1388436943.731508: @value"ß {I" class:EFI"ProcessedAsset;FI"logical_path;FI"(mercury/dependencies/liquidmetal.js;FI" pathname;FI"›/Users/jrissler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/mercury-6daffeeb487e/app/assets/javascripts/mercury/dependencies/liquidmetal.js;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-11-20T08:09:45-05:00;FI" length;FiÏ I" digest;F"%f1198006e1da59184f3db212c557f521I" source;FI"Ï /* * LiquidMetal, version: 0.1 (2009-02-05) * * A mimetic poly-alloy of Quicksilver's scoring algorithm, essentially * LiquidMetal. * * For usage and examples, visit: * http://github.com/rmm5t/liquidmetal * * Licensed under the MIT: * http://www.opensource.org/licenses/mit-license.php * * Copyright (c) 2009, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) */ var LiquidMetal = function() { var SCORE_NO_MATCH = 0.0; var SCORE_MATCH = 1.0; var SCORE_TRAILING = 0.8; var SCORE_TRAILING_BUT_STARTED = 0.9; var SCORE_BUFFER = 0.85; return { score: function(string, abbreviation) { // Short circuits if (abbreviation.length == 0) return SCORE_TRAILING; if (abbreviation.length > string.length) return SCORE_NO_MATCH; var scores = this.buildScoreArray(string, abbreviation); var sum = 0.0; for (var i =0; i < scores.length; i++) { sum += scores[i]; } return (sum / scores.length); }, buildScoreArray: function(string, abbreviation) { var scores = new Array(string.length); var lower = string.toLowerCase(); var chars = abbreviation.toLowerCase().split(""); var lastIndex = -1; var started = false; for (var i =0; i < chars.length; i++) { var c = chars[i]; var index = lower.indexOf(c, lastIndex+1); if (index < 0) return fillArray(scores, SCORE_NO_MATCH); if (index == 0) started = true; if (isNewWord(string, index)) { scores[index-1] = 1; fillArray(scores, SCORE_BUFFER, lastIndex+1, index-1); } else if (isUpperCase(string, index)) { fillArray(scores, SCORE_BUFFER, lastIndex+1, index); } else { fillArray(scores, SCORE_NO_MATCH, lastIndex+1, index); } scores[index] = SCORE_MATCH; lastIndex = index; } var trailingScore = started ? SCORE_TRAILING_BUT_STARTED : SCORE_TRAILING; fillArray(scores, trailingScore, lastIndex+1); return scores; } }; function isUpperCase(string, index) { var c = string.charAt(index); return ("A" <= c && c <= "Z"); } function isNewWord(string, index) { var c = string.charAt(index-1); return (c == " " || c == "\t"); } function fillArray(array, value, from, to) { from = Math.max(from || 0, 0); to = Math.min(to || array.length, array.length); for (var i = from; i < to; i++) { array[i] = value; } return array; } }(); ;FI"dependency_digest;F"%ef7ea481aa9878ace8874395505a4466I"required_paths;F[I"›/Users/jrissler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/mercury-6daffeeb487e/app/assets/javascripts/mercury/dependencies/liquidmetal.js;FI"dependency_paths;F[{I" path;FI"›/Users/jrissler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/bundler/gems/mercury-6daffeeb487e/app/assets/javascripts/mercury/dependencies/liquidmetal.js;FI" mtime;FI"2013-11-20T08:09:45-05:00;FI" digest;F"%6b14d9a73ce5bfe84acef1099fc4e7d8I" _version;F"%6776f581a4329e299531e1d52aa59832