o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1355470614.800104:@value"� {I" class:EFI"ProcessedAsset;�FI"logical_path;�FI"(mercury/dependencies/liquidmetal.js;�FI" pathname;�FI"~/Users/brownjohn/.rvm/gems/ruby-1.9.3-p194/gems/mercury-rails-0.8.0/app/assets/javascripts/mercury/dependencies/liquidmetal.js;�FI"content_type;�FI"application/javascript;�FI" mtime;�FI"2012-08-08T16:13:36+08:00;�FI"length;�Fi� I"digest;�F"%9a136ce23a0adc8f9c5047a6b17d7e40I"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"%8e5eb9647eb97deadf0f69e0780f2812I"required_paths;�F[I"~/Users/brownjohn/.rvm/gems/ruby-1.9.3-p194/gems/mercury-rails-0.8.0/app/assets/javascripts/mercury/dependencies/liquidmetal.js;�FI"dependency_paths;�F[{I" path;�FI"~/Users/brownjohn/.rvm/gems/ruby-1.9.3-p194/gems/mercury-rails-0.8.0/app/assets/javascripts/mercury/dependencies/liquidmetal.js;�FI" mtime;�FI"2012-08-08T16:13:36+08:00;�FI"digest;�F"%6b13bb33b60127182cde7e4db5ad9163I" _version;�F"%9f3b95dd7ea3030dc35985c0a8020862