yellow-brick-road 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. data/README.rst +148 -0
  2. data/Rakefile +37 -0
  3. data/lib/tasks/yellow-brick-road_tasks.rake +4 -0
  4. data/lib/yellow-brick-road.rb +6 -0
  5. data/lib/yellow-brick-road/config.rb +15 -0
  6. data/lib/yellow-brick-road/directive_processor.rb +68 -0
  7. data/lib/yellow-brick-road/engine.rb +22 -0
  8. data/lib/yellow-brick-road/soy_processor.rb +56 -0
  9. data/lib/yellow-brick-road/utils.rb +38 -0
  10. data/lib/yellow-brick-road/version.rb +3 -0
  11. data/test/dummy/Rakefile +7 -0
  12. data/test/dummy/app/assets/javascripts/application.js +12 -0
  13. data/test/dummy/app/assets/javascripts/closure-deps.js +4 -0
  14. data/test/dummy/app/assets/javascripts/my-closure/simple.js.soy +14 -0
  15. data/test/dummy/app/assets/javascripts/my-closure/start.js +25 -0
  16. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  17. data/test/dummy/app/controllers/application_controller.rb +7 -0
  18. data/test/dummy/app/helpers/application_helper.rb +2 -0
  19. data/test/dummy/app/views/application/index.html.erb +0 -0
  20. data/test/dummy/app/views/layouts/application.html.erb +18 -0
  21. data/test/dummy/config.ru +4 -0
  22. data/test/dummy/config/application.rb +51 -0
  23. data/test/dummy/config/boot.rb +10 -0
  24. data/test/dummy/config/environment.rb +5 -0
  25. data/test/dummy/config/environments/development.rb +30 -0
  26. data/test/dummy/config/environments/production.rb +60 -0
  27. data/test/dummy/config/environments/test.rb +39 -0
  28. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/dummy/config/initializers/inflections.rb +10 -0
  30. data/test/dummy/config/initializers/mime_types.rb +5 -0
  31. data/test/dummy/config/initializers/secret_token.rb +7 -0
  32. data/test/dummy/config/initializers/session_store.rb +8 -0
  33. data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
  34. data/test/dummy/config/initializers/yellow_brick_road.rb +2 -0
  35. data/test/dummy/config/locales/en.yml +5 -0
  36. data/test/dummy/config/routes.rb +58 -0
  37. data/test/dummy/log/development.log +13924 -0
  38. data/test/dummy/log/test.log +0 -0
  39. data/test/dummy/public/404.html +26 -0
  40. data/test/dummy/public/422.html +26 -0
  41. data/test/dummy/public/500.html +26 -0
  42. data/test/dummy/public/favicon.ico +0 -0
  43. data/test/dummy/script/rails +6 -0
  44. data/test/dummy/tmp/cache/assets/BE0/120/sprockets%2F751842b8c6750008c7310d182600d173 +142 -0
  45. data/test/dummy/tmp/cache/assets/C19/950/sprockets%2F142437f1d8d9424007b4a882a5429333 +1372 -0
  46. data/test/dummy/tmp/cache/assets/C4B/D00/sprockets%2F400f22c081529179ce3d079457de3009 +806 -0
  47. data/test/dummy/tmp/cache/assets/C5A/EE0/sprockets%2Fb711429ed948c503b718d077037780f8 +0 -0
  48. data/test/dummy/tmp/cache/assets/C5B/A80/sprockets%2F508569b474262724c61a461f7777dab7 +1118 -0
  49. data/test/dummy/tmp/cache/assets/C6C/660/sprockets%2F2c298b3b02232a21527680685a3efc30 +9289 -0
  50. data/test/dummy/tmp/cache/assets/C72/8A0/sprockets%2F167b265129e30d87d253c406db305c60 +293 -0
  51. data/test/dummy/tmp/cache/assets/C7E/9F0/sprockets%2F89862076204c62c4593ac20de32da909 +9 -0
  52. data/test/dummy/tmp/cache/assets/C8B/5F0/sprockets%2Fc6a4470b5c21e285e829a99365839b24 +0 -0
  53. data/test/dummy/tmp/cache/assets/C92/D20/sprockets%2F2e618f7805f445889aec94885a500f03 +457 -0
  54. data/test/dummy/tmp/cache/assets/C98/FD0/sprockets%2Fb11442af041f96e87a43a1dc11231745 +283 -0
  55. data/test/dummy/tmp/cache/assets/CA3/520/sprockets%2F5379d7143c6c52b11b88dc0ab5436133 +277 -0
  56. data/test/dummy/tmp/cache/assets/CA5/450/sprockets%2F6bb727c9312a749134ad67323a317f0d +73 -0
  57. data/test/dummy/tmp/cache/assets/CA5/4F0/sprockets%2Feeb7de7771527700af194c0441d29101 +709 -0
  58. data/test/dummy/tmp/cache/assets/CA6/E90/sprockets%2F611f68180f43c4181f06ae5c5f8201e2 +1546 -0
  59. data/test/dummy/tmp/cache/assets/CA7/310/sprockets%2F45664cf816315200b574e029fde6f10a +0 -0
  60. data/test/dummy/tmp/cache/assets/CA9/9D0/sprockets%2F2672e32464cf7267c4ba3d028f54b153 +224 -0
  61. data/test/dummy/tmp/cache/assets/CAB/5A0/sprockets%2F7f50e0289f150c8636ac9253129bc13c +2556 -0
  62. data/test/dummy/tmp/cache/assets/CB5/7E0/sprockets%2F42ff6672683b2029233a800e7539eeee +474 -0
  63. data/test/dummy/tmp/cache/assets/CB6/DC0/sprockets%2F2f9882155bb2d4d3ab5d708951857c60 +494 -0
  64. data/test/dummy/tmp/cache/assets/CBB/680/sprockets%2F1dc336d96fb52df34b458185559922b5 +1018 -0
  65. data/test/dummy/tmp/cache/assets/CBC/640/sprockets%2F67d2e0d9e5129d237e575d2780c64b47 +1260 -0
  66. data/test/dummy/tmp/cache/assets/CBE/550/sprockets%2Fd680cac830e0b3408ba910f0b0421147 +25 -0
  67. data/test/dummy/tmp/cache/assets/CC7/790/sprockets%2F69941f32a12e4f99d4a57f65386d870d +608 -0
  68. data/test/dummy/tmp/cache/assets/CCB/F80/sprockets%2Fa865701ef2ec41155e524772c31a1a2b +1088 -0
  69. data/test/dummy/tmp/cache/assets/CCE/580/sprockets%2F879411ed27ed1c557d57853d8f579b56 +0 -0
  70. data/test/dummy/tmp/cache/assets/CD0/070/sprockets%2F6748fe8481965f260d9c56b7f9f508a2 +1530 -0
  71. data/test/dummy/tmp/cache/assets/CD4/750/sprockets%2Faf3505141ecb3169ce41ce519d136924 +0 -0
  72. data/test/dummy/tmp/cache/assets/CD6/A90/sprockets%2F3f55ac75b9fb8426312116bcb940a580 +2539 -0
  73. data/test/dummy/tmp/cache/assets/CD9/6C0/sprockets%2F5e2458bc52da90ba349a66035e3b6752 +0 -0
  74. data/test/dummy/tmp/cache/assets/CD9/F50/sprockets%2F9008bf696500cfae1d61f045f209181e +256 -0
  75. data/test/dummy/tmp/cache/assets/CDB/B40/sprockets%2F53529a22c994570a0df4742c0bfe61f4 +0 -0
  76. data/test/dummy/tmp/cache/assets/CDC/D10/sprockets%2F1e775b4ff06b4401c07503ce95a839b5 +75 -0
  77. data/test/dummy/tmp/cache/assets/CDE/CD0/sprockets%2F141066798b4acf07053f7e3a6cb4e555 +1613 -0
  78. data/test/dummy/tmp/cache/assets/CE1/760/sprockets%2F245fe11803630fe30d0cf8a869886ab5 +357 -0
  79. data/test/dummy/tmp/cache/assets/CE1/FA0/sprockets%2F863d1650ef066e4a2168bc57c7c0e096 +0 -0
  80. data/test/dummy/tmp/cache/assets/CE2/310/sprockets%2Fd38075d5592ecaf82e43526c03b467c4 +1545 -0
  81. data/test/dummy/tmp/cache/assets/CE2/420/sprockets%2F30f2e8f30477e80cf6416dfe27307c07 +204 -0
  82. data/test/dummy/tmp/cache/assets/CE2/D70/sprockets%2F467c44b63644e0f44dd06a585f36f1a6 +522 -0
  83. data/test/dummy/tmp/cache/assets/CE3/670/sprockets%2Fddd11860b444cd0f9996be0c46762318 +796 -0
  84. data/test/dummy/tmp/cache/assets/CE4/0B0/sprockets%2Ff11535d785c0d34349c64d673bd4b28f +1105 -0
  85. data/test/dummy/tmp/cache/assets/CE4/590/sprockets%2Fd68edcc87a4ae302794093081b45b819 +10 -0
  86. data/test/dummy/tmp/cache/assets/CE4/D60/sprockets%2F61772e4a60b616f74da91b838a2f4f82 +0 -0
  87. data/test/dummy/tmp/cache/assets/CE6/DD0/sprockets%2F2fe073024a2bf26bd98458388b57af37 +1355 -0
  88. data/test/dummy/tmp/cache/assets/CE7/160/sprockets%2Fba1f9939f031b4356ec1869d40fc2747 +1261 -0
  89. data/test/dummy/tmp/cache/assets/CE8/C70/sprockets%2Fc6c9ba3c677b5e2af8520395192c9445 +173 -0
  90. data/test/dummy/tmp/cache/assets/CEA/8B0/sprockets%2Ff77e549cb6d37604105f35d4e67d8c21 +511 -0
  91. data/test/dummy/tmp/cache/assets/CEA/AA0/sprockets%2F5f816982c86d2e6b72b2f5f65c51d070 +1529 -0
  92. data/test/dummy/tmp/cache/assets/CEA/C10/sprockets%2F9dcd541e67c299ab076a44a2183872f8 +0 -0
  93. data/test/dummy/tmp/cache/assets/CF1/5A0/sprockets%2F1a697695edf2bb7b49a2896904218bc7 +115 -0
  94. data/test/dummy/tmp/cache/assets/CF4/480/sprockets%2F5e99c77e93f4a522c84357e62b25e0f7 +43 -0
  95. data/test/dummy/tmp/cache/assets/CF7/460/sprockets%2Fd12ea9733fe3c92456f57f9145569b9c +0 -0
  96. data/test/dummy/tmp/cache/assets/CF7/470/sprockets%2F2897897a166ca3369fecb88f83f211b5 +435 -0
  97. data/test/dummy/tmp/cache/assets/CFA/760/sprockets%2Fa9024adba14091e0635c6874d1db4e22 +0 -0
  98. data/test/dummy/tmp/cache/assets/D01/F30/sprockets%2Fe639a15b6e0cca37d12443b408e1166f +25 -0
  99. data/test/dummy/tmp/cache/assets/D02/9F0/sprockets%2Fb99eae308897fe88cb9414b96824098b +0 -0
  100. data/test/dummy/tmp/cache/assets/D03/330/sprockets%2F1e003cdb3e7dcc9307e84090ad457127 +454 -0
  101. data/test/dummy/tmp/cache/assets/D03/8B0/sprockets%2Ff74632bddf2c0b2018ca7b736309380e +365 -0
  102. data/test/dummy/tmp/cache/assets/D05/0A0/sprockets%2Fe57658220260db13eb5577aef42cb61b +257 -0
  103. data/test/dummy/tmp/cache/assets/D05/920/sprockets%2F909507434dcc270db4853e4c147f0aac +31 -0
  104. data/test/dummy/tmp/cache/assets/D08/510/sprockets%2Fa567be6cb6d7310096f1739b25a5a3f0 +50 -0
  105. data/test/dummy/tmp/cache/assets/D08/9F0/sprockets%2F1d61d2c89ca50957066bacc5b69011f5 +1424 -0
  106. data/test/dummy/tmp/cache/assets/D0A/790/sprockets%2Feb16913e6504c9b0d3be431de39e4751 +300 -0
  107. data/test/dummy/tmp/cache/assets/D0C/C50/sprockets%2Fd6613bee8b40d50459af6b52a7084f34 +796 -0
  108. data/test/dummy/tmp/cache/assets/D0D/030/sprockets%2Fba3f13b4a444679e8bc2549226ec743b +21 -0
  109. data/test/dummy/tmp/cache/assets/D0D/350/sprockets%2F2670bce036d485e15d059c0f1e98f24a +207 -0
  110. data/test/dummy/tmp/cache/assets/D13/270/sprockets%2F497cb163e6317e3fc1565d832f406cfb +348 -0
  111. data/test/dummy/tmp/cache/assets/D13/380/sprockets%2F786d003c9c7fb759dd26c1030c087cf6 +813 -0
  112. data/test/dummy/tmp/cache/assets/D13/7C0/sprockets%2F528d22310a9ab8e6fba08d82844ce795 +0 -0
  113. data/test/dummy/tmp/cache/assets/D15/F60/sprockets%2Fa28394e3f80365b5bc86794dd46daa22 +0 -0
  114. data/test/dummy/tmp/cache/assets/D18/500/sprockets%2Fd22c2d97d1db2154f2f7592906e957ea +1001 -0
  115. data/test/dummy/tmp/cache/assets/D1B/C70/sprockets%2F1c04848b1e1d6e8e33b8581f8c8128ff +223 -0
  116. data/test/dummy/tmp/cache/assets/D1C/600/sprockets%2Fa0601f99147f59ddd6266e6aff077e14 +0 -0
  117. data/test/dummy/tmp/cache/assets/D1E/470/sprockets%2Fb3933e694547b78bf6fb15f44a4623fe +53 -0
  118. data/test/dummy/tmp/cache/assets/D1F/480/sprockets%2F545164168becf42b289efc8708f1db68 +1278 -0
  119. data/test/dummy/tmp/cache/assets/D21/630/sprockets%2F0a14114729c14637f2e8f122acabd1ab +823 -0
  120. data/test/dummy/tmp/cache/assets/D24/A90/sprockets%2F21c8a0d48c51b8585ba03bc112ecd153 +692 -0
  121. data/test/dummy/tmp/cache/assets/D25/D30/sprockets%2F3b937f4c16d2aa0a28fc02a0e922712b +1441 -0
  122. data/test/dummy/tmp/cache/assets/D25/F30/sprockets%2Fe251527c0c018f4b4ad44b2ad7064fb0 +2255 -0
  123. data/test/dummy/tmp/cache/assets/D26/DE0/sprockets%2F761ac1bdb0739cc56fa0c1224b137b09 +0 -0
  124. data/test/dummy/tmp/cache/assets/D2A/C30/sprockets%2F978fe7268754f451c59b9ccb323ffa56 +0 -0
  125. data/test/dummy/tmp/cache/assets/D2B/0F0/sprockets%2Fbf223af03335cfc08a71e549e10c0e27 +2539 -0
  126. data/test/dummy/tmp/cache/assets/D2E/6D0/sprockets%2F9e7fda3affb389313cc50223f01c0324 +0 -0
  127. data/test/dummy/tmp/cache/assets/D2F/110/sprockets%2F3730ffe2ed34c1219d580bd1615ea7b0 +2239 -0
  128. data/test/dummy/tmp/cache/assets/D2F/F10/sprockets%2F9cac242f0bf5ec00079ea3a463e26552 +153 -0
  129. data/test/dummy/tmp/cache/assets/D30/1D0/sprockets%2Fd690a26a0b0ae138c1c48d257a7674bc +589 -0
  130. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  131. data/test/dummy/tmp/cache/assets/D36/940/sprockets%2Fb4ba462ac9f4aac561c36e60367c1378 +572 -0
  132. data/test/dummy/tmp/cache/assets/D37/090/sprockets%2F2f2e71ebbc240014ebf648f0917e854a +798 -0
  133. data/test/dummy/tmp/cache/assets/D3A/440/sprockets%2F6d332243647c841dea36ed822cdfc23e +165 -0
  134. data/test/dummy/tmp/cache/assets/D3B/5A0/sprockets%2F82e05cf8c88ba8cb1c87e50d51372a03 +0 -0
  135. data/test/dummy/tmp/cache/assets/D41/B30/sprockets%2Fba1b93913dd01d83ac9a96df334456f8 +0 -0
  136. data/test/dummy/tmp/cache/assets/D43/D90/sprockets%2F04f3a5926d5a7672456dc7afa73d0c7f +38 -0
  137. data/test/dummy/tmp/cache/assets/D45/1F0/sprockets%2F1bfa855d9c10ff2431a9a548958cc5e4 +83 -0
  138. data/test/dummy/tmp/cache/assets/D45/B10/sprockets%2F643f3d9b216e48df952b7f150a46a7ec +60 -0
  139. data/test/dummy/tmp/cache/assets/D46/040/sprockets%2F199546844e5939721a5afcbcce4ea43a +143 -0
  140. data/test/dummy/tmp/cache/assets/D49/320/sprockets%2Fd8123eb229e34c9f507f7b1876f1c4ee +506 -0
  141. data/test/dummy/tmp/cache/assets/D49/750/sprockets%2Ff41ef1c0832b7294fb15588ff5c783cb +0 -0
  142. data/test/dummy/tmp/cache/assets/D49/930/sprockets%2F1071926698fa55abc71e1b6fd966dfe1 +72 -0
  143. data/test/dummy/tmp/cache/assets/D49/D10/sprockets%2Fb67b8d7cc7579352a91694f9ae10cdb0 +127 -0
  144. data/test/dummy/tmp/cache/assets/D4A/160/sprockets%2Fcbd8988b5e18d153eff6230d72e9046a +516 -0
  145. data/test/dummy/tmp/cache/assets/D4A/2B0/sprockets%2Ffcdf002d38fd938bf7226b46b76706c8 +1101 -0
  146. data/test/dummy/tmp/cache/assets/D4E/2F0/sprockets%2F77cb87ae57f0d8c25cdaa74181a64997 +1441 -0
  147. data/test/dummy/tmp/cache/assets/D4F/060/sprockets%2Fa9e66b39ada7394a29bf44f3a682f665 +511 -0
  148. data/test/dummy/tmp/cache/assets/D50/BD0/sprockets%2F88650dd57ef64075462e6dae757dbe2c +0 -0
  149. data/test/dummy/tmp/cache/assets/D53/CA0/sprockets%2Fa85032e82709a043fbb2ec00e04f2bbd +0 -0
  150. data/test/dummy/tmp/cache/assets/D54/BF0/sprockets%2F91970514ff528e8d2bfd81f1ec83c9c8 +240 -0
  151. data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +10 -0
  152. data/test/dummy/tmp/cache/assets/D56/500/sprockets%2F75ebadd035f1324b194034af92eac3a0 +0 -0
  153. data/test/dummy/tmp/cache/assets/D5A/900/sprockets%2F5729f77d97fdee53b1942cf17f6f05e4 +474 -0
  154. data/test/dummy/tmp/cache/assets/D5A/D50/sprockets%2F81bace3db2c2f1241175ff3c5009d08c +0 -0
  155. data/test/dummy/tmp/cache/assets/D5B/C70/sprockets%2Fe64119a9db7017b7ab3b0da1b6076f0d +44 -0
  156. data/test/dummy/tmp/cache/assets/D5E/4D0/sprockets%2F756f25e4ad861a050cdc41bb8414e4ab +126 -0
  157. data/test/dummy/tmp/cache/assets/D5E/730/sprockets%2Fd30caf70b387c4604326bdda32aeb549 +0 -0
  158. data/test/dummy/tmp/cache/assets/D5E/AA0/sprockets%2F790dd07caaaacb30ceb0174664e90817 +136 -0
  159. data/test/dummy/tmp/cache/assets/D64/D30/sprockets%2Fe4bd8f60a3a446274c3cb2f5d16563ac +590 -0
  160. data/test/dummy/tmp/cache/assets/D66/400/sprockets%2Fecb7401d20daf25605a7afad3a793778 +0 -0
  161. data/test/dummy/tmp/cache/assets/D67/250/sprockets%2F8422eb26855ca9c953a3bf1aeade8004 +0 -0
  162. data/test/dummy/tmp/cache/assets/D69/900/sprockets%2F28ae64f52cb18f77b1a1bd9c51293da4 +0 -0
  163. data/test/dummy/tmp/cache/assets/D6A/870/sprockets%2F1ece6a51b42f9280f4cee9020c94b72e +197 -0
  164. data/test/dummy/tmp/cache/assets/D6B/DD0/sprockets%2F9a0abc735e27fc61dab019788518eba4 +164 -0
  165. data/test/dummy/tmp/cache/assets/D6E/CC0/sprockets%2F8b4fbcec2475e7203b8859baf8e310a3 +0 -0
  166. data/test/dummy/tmp/cache/assets/D72/470/sprockets%2Fbc0c6d850e7c769e83d58eb3e6061b2a +2556 -0
  167. data/test/dummy/tmp/cache/assets/D72/9D0/sprockets%2F9402daf6da6f7eed331a9d78216cb761 +0 -0
  168. data/test/dummy/tmp/cache/assets/D74/070/sprockets%2F91ae68f698a39bd7d0d11150fc46e4cd +418 -0
  169. data/test/dummy/tmp/cache/assets/D74/7F0/sprockets%2F22dad1069ea6a8f29ae757c44e18ec83 +0 -0
  170. data/test/dummy/tmp/cache/assets/D75/3C0/sprockets%2F44e2ae51b97853d8ecda7b264a267c7d +1630 -0
  171. data/test/dummy/tmp/cache/assets/D77/780/sprockets%2Ffa2abdfb0b62867c346f79187b8e42d5 +823 -0
  172. data/test/dummy/tmp/cache/assets/D79/850/sprockets%2F4d540586ed379fd9a70fa0b7ce4f5b27 +306 -0
  173. data/test/dummy/tmp/cache/assets/D7A/B60/sprockets%2F5925c92f48caff053d08853dc69e5bba +0 -0
  174. data/test/dummy/tmp/cache/assets/D81/C90/sprockets%2F19aca5c835efce74878c23e581e2a89e +2239 -0
  175. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +11228 -0
  176. data/test/dummy/tmp/cache/assets/D8B/B10/sprockets%2Fbb7a2305a8f2832631863bbababb67be +301 -0
  177. data/test/dummy/tmp/cache/assets/D92/3B0/sprockets%2F93dc71f411faf72ec8ef0b5d217b51a0 +505 -0
  178. data/test/dummy/tmp/cache/assets/D92/EE0/sprockets%2Ffd051ea0abf6be6970754aa732e40c8b +289 -0
  179. data/test/dummy/tmp/cache/assets/D93/810/sprockets%2F7dc1ac5e1b83ba5144e34cf156d48a8a +471 -0
  180. data/test/dummy/tmp/cache/assets/D94/020/sprockets%2F35cb4ce22488fb5bdd260508ca47a3fb +239 -0
  181. data/test/dummy/tmp/cache/assets/D94/EC0/sprockets%2F8b900fba18f8e046f5f12e6d1f0ac15b +74 -0
  182. data/test/dummy/tmp/cache/assets/D95/470/sprockets%2F5be5d361a52575c433831b5e8cccbace +9273 -0
  183. data/test/dummy/tmp/cache/assets/D97/9D0/sprockets%2F524a2a94a88c1d392dabcba654e365fc +103 -0
  184. data/test/dummy/tmp/cache/assets/D9D/800/sprockets%2Ff8387220eb4dda9b29a37b5deb9f2a40 +54 -0
  185. data/test/dummy/tmp/cache/assets/D9E/DD0/sprockets%2Fb6b4ffad6485eda046b327a196e8c44a +0 -0
  186. data/test/dummy/tmp/cache/assets/DA1/0A0/sprockets%2F359c94aee6ba2e15fc9666aa4de311c8 +166 -0
  187. data/test/dummy/tmp/cache/assets/DA1/0D0/sprockets%2F798de3c28452e164a7fc1a3a6e8cdb4b +652 -0
  188. data/test/dummy/tmp/cache/assets/DA3/CB0/sprockets%2Fdfad6bb1857a8af91f98ba137c18504e +815 -0
  189. data/test/dummy/tmp/cache/assets/DA4/E10/sprockets%2Fbda7705734ace95f12a7d79df9c14af2 +1354 -0
  190. data/test/dummy/tmp/cache/assets/DA5/E30/sprockets%2F2e6707a119e94a784efbadca18d7e8d1 +129 -0
  191. data/test/dummy/tmp/cache/assets/DA6/4B0/sprockets%2F4f7a708b6aa2d42eb577493dea7cef55 +115 -0
  192. data/test/dummy/tmp/cache/assets/DA8/A10/sprockets%2F0ae5bbb4ca200e74db3b64d72c2be120 +0 -0
  193. data/test/dummy/tmp/cache/assets/DA9/3F0/sprockets%2Fdd0af9cfd65fb7d02fe778c8f6015361 +499 -0
  194. data/test/dummy/tmp/cache/assets/DA9/780/sprockets%2Fe3559a635e8f92dec7727a3db2ae7b4c +813 -0
  195. data/test/dummy/tmp/cache/assets/DAC/0E0/sprockets%2F04cef8243a9ef7321846debc977ea8db +607 -0
  196. data/test/dummy/tmp/cache/assets/DB1/260/sprockets%2Fb879ff7530bf8cc175e0c7e70dc4e79b +0 -0
  197. data/test/dummy/tmp/cache/assets/DB4/4C0/sprockets%2F30a76cbd98dedb56742cd8ecaf858757 +0 -0
  198. data/test/dummy/tmp/cache/assets/DBD/7E0/sprockets%2F236fb1ac5ed9f2e3fe32203acc3a842d +0 -0
  199. data/test/dummy/tmp/cache/assets/DC2/DF0/sprockets%2Fe233bcaba8beff15626c35cb5e0e0936 +845 -0
  200. data/test/dummy/tmp/cache/assets/DC4/600/sprockets%2F59c96aa6c1cbebc61bff6c050a5351d7 +225 -0
  201. data/test/dummy/tmp/cache/assets/DC5/030/sprockets%2Fcb2fe864a0177eec19017c43ce9aa4ad +187 -0
  202. data/test/dummy/tmp/cache/assets/DC8/A60/sprockets%2F9fcb9f5c3f679ce749ee4c3f93869ba6 +74 -0
  203. data/test/dummy/tmp/cache/assets/DCB/D40/sprockets%2Ffd5542bfb7660a8d8cac3a2e46fb01f8 +828 -0
  204. data/test/dummy/tmp/cache/assets/DCC/020/sprockets%2F0c129c5f2784c96fa1dc3da6c19c1efc +128 -0
  205. data/test/dummy/tmp/cache/assets/DCF/520/sprockets%2F975162fb97a3ec7033db5f2fdba4fcd3 +70 -0
  206. data/test/dummy/tmp/cache/assets/DD0/000/sprockets%2F0d5d631cce6f0b078bb29cf98b3d78bb +276 -0
  207. data/test/dummy/tmp/cache/assets/DD0/C90/sprockets%2F84eeca4ef8f5eb29b13f7e1ea3c71324 +591 -0
  208. data/test/dummy/tmp/cache/assets/DD6/710/sprockets%2F9e83f2ebbe3e349efca2de390e15d635 +204 -0
  209. data/test/dummy/tmp/cache/assets/DE1/830/sprockets%2Fd23d3cafef2e2a9055bc103dffc1a023 +208 -0
  210. data/test/dummy/tmp/cache/assets/DEB/470/sprockets%2Fae2de0fcbc2214b71d3f2a875d2bc8c3 +2255 -0
  211. data/test/dummy/tmp/cache/assets/DEE/690/sprockets%2F5d824bcadef29060cc13eed71af4b4d0 +550 -0
  212. data/test/dummy/tmp/cache/assets/DF0/5D0/sprockets%2F25a875eb0a5d4c49bcc3fa39ea0adb26 +567 -0
  213. data/test/dummy/tmp/cache/assets/DF3/E20/sprockets%2Fada770c49a5d6b38d1cc43ed4d51c1fc +0 -0
  214. data/test/dummy/tmp/cache/assets/DF5/C80/sprockets%2F03ad7d7b3a8feba9ed9be82ae2083b20 +340 -0
  215. data/test/dummy/tmp/cache/assets/DF6/560/sprockets%2Fafceb2b55eb108efe4446dfb02b519b8 +0 -0
  216. data/test/dummy/tmp/cache/assets/DFC/030/sprockets%2Fcbdd3679eaba219b4e1ff20677af1c6f +1371 -0
  217. data/test/dummy/tmp/cache/assets/E00/970/sprockets%2F8bc6dde8d05c382dd07cbcec70f54e09 +378 -0
  218. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  219. data/test/dummy/tmp/cache/assets/E12/2F0/sprockets%2F5c45062ecfbe512dcba176ba6ddacc00 +523 -0
  220. data/test/dummy/tmp/cache/assets/E21/5D0/sprockets%2Fd4fe6d611bfb0e63c04de5dbfb128a8a +0 -0
  221. data/test/dummy/tmp/cache/assets/E22/770/sprockets%2F2ccebcabfbb9b59159e4b73b3b30a74d +208 -0
  222. data/test/dummy/tmp/cache/assets/E31/A90/sprockets%2F26b98bbbc15eee9b370c7dcde88d16aa +394 -0
  223. data/test/dummy/tmp/cache/assets/E31/E30/sprockets%2Ffbdafcc4e2f44bb9fc653bcf9625b750 +284 -0
  224. data/test/dummy/tmp/cache/assets/E37/1C0/sprockets%2Fa5eb45fc86dafe2bee4e4fa3f53c4785 +0 -0
  225. data/test/dummy/tmp/cache/assets/E4C/960/sprockets%2F13fd6e4bfdf031acb3dedca8d0f407b4 +1277 -0
  226. data/test/dummy/tmp/cache/assets/E88/330/sprockets%2Fe02d0adb5529ffafcea1b9e5ccf69a5b +669 -0
  227. data/test/dummy/tmp/pids/server.pid +1 -0
  228. data/test/dummy/tmp/simple.js.js +20 -0
  229. data/test/dummy/tmp/soy-1325274421.js +20 -0
  230. data/test/dummy/tmp/soy-1325286267.js +20 -0
  231. data/test/test_helper.rb +10 -0
  232. data/test/yellow-brick-road_test.rb +7 -0
  233. metadata +538 -0
@@ -0,0 +1,223 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325441615.6458209: @value{ I" length:EFi�I" digest;
2
+ F"%09de1b3d739e2a82945c2bb8058e6731I" source;
3
+ FI"�// Copyright 2006 The Closure Library Authors. All Rights Reserved.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS-IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+
17
+ /**
18
+ * @fileoverview Low level handling of XMLHttpRequest.
19
+ * @author arv@google.com (Erik Arvidsson)
20
+ * @author dbk@google.com (David Barrett-Kahn)
21
+ */
22
+
23
+
24
+ goog.provide('goog.net.DefaultXmlHttpFactory');
25
+ goog.provide('goog.net.XmlHttp');
26
+ goog.provide('goog.net.XmlHttp.OptionType');
27
+ goog.provide('goog.net.XmlHttp.ReadyState');
28
+
29
+ goog.require('goog.net.WrapperXmlHttpFactory');
30
+ goog.require('goog.net.XmlHttpFactory');
31
+
32
+
33
+ /**
34
+ * Static class for creating XMLHttpRequest objects.
35
+ * @return {!(XMLHttpRequest|GearsHttpRequest)} A new XMLHttpRequest object.
36
+ */
37
+ goog.net.XmlHttp = function() {
38
+ return goog.net.XmlHttp.factory_.createInstance();
39
+ };
40
+
41
+
42
+ /**
43
+ * Gets the options to use with the XMLHttpRequest objects obtained using
44
+ * the static methods.
45
+ * @return {Object} The options.
46
+ */
47
+ goog.net.XmlHttp.getOptions = function() {
48
+ return goog.net.XmlHttp.factory_.getOptions();
49
+ };
50
+
51
+
52
+ /**
53
+ * Type of options that an XmlHttp object can have.
54
+ * @enum {number}
55
+ */
56
+ goog.net.XmlHttp.OptionType = {
57
+ /**
58
+ * Whether a goog.nullFunction should be used to clear the onreadystatechange
59
+ * handler instead of null.
60
+ */
61
+ USE_NULL_FUNCTION: 0,
62
+
63
+ /**
64
+ * NOTE(user): In IE if send() errors on a *local* request the readystate
65
+ * is still changed to COMPLETE. We need to ignore it and allow the
66
+ * try/catch around send() to pick up the error.
67
+ */
68
+ LOCAL_REQUEST_ERROR: 1
69
+ };
70
+
71
+
72
+ /**
73
+ * Status constants for XMLHTTP, matches:
74
+ * http://msdn.microsoft.com/library/default.asp?url=/library/
75
+ * en-us/xmlsdk/html/0e6a34e4-f90c-489d-acff-cb44242fafc6.asp
76
+ * @enum {number}
77
+ */
78
+ goog.net.XmlHttp.ReadyState = {
79
+ /**
80
+ * Constant for when xmlhttprequest.readyState is uninitialized
81
+ */
82
+ UNINITIALIZED: 0,
83
+
84
+ /**
85
+ * Constant for when xmlhttprequest.readyState is loading.
86
+ */
87
+ LOADING: 1,
88
+
89
+ /**
90
+ * Constant for when xmlhttprequest.readyState is loaded.
91
+ */
92
+ LOADED: 2,
93
+
94
+ /**
95
+ * Constant for when xmlhttprequest.readyState is in an interactive state.
96
+ */
97
+ INTERACTIVE: 3,
98
+
99
+ /**
100
+ * Constant for when xmlhttprequest.readyState is completed
101
+ */
102
+ COMPLETE: 4
103
+ };
104
+
105
+
106
+ /**
107
+ * The global factory instance for creating XMLHttpRequest objects.
108
+ * @type {goog.net.XmlHttpFactory}
109
+ * @private
110
+ */
111
+ goog.net.XmlHttp.factory_;
112
+
113
+
114
+ /**
115
+ * Sets the factories for creating XMLHttpRequest objects and their options.
116
+ * @param {Function} factory The factory for XMLHttpRequest objects.
117
+ * @param {Function} optionsFactory The factory for options.
118
+ * @deprecated Use setGlobalFactory instead.
119
+ */
120
+ goog.net.XmlHttp.setFactory = function(factory, optionsFactory) {
121
+ goog.net.XmlHttp.setGlobalFactory(new goog.net.WrapperXmlHttpFactory(
122
+ (/** @type {function() : !(XMLHttpRequest|GearsHttpRequest)} */ factory),
123
+ (/** @type {function() : !Object}*/ optionsFactory)));
124
+ };
125
+
126
+
127
+ /**
128
+ * Sets the global factory object.
129
+ * @param {!goog.net.XmlHttpFactory} factory New global factory object.
130
+ */
131
+ goog.net.XmlHttp.setGlobalFactory = function(factory) {
132
+ goog.net.XmlHttp.factory_ = factory;
133
+ };
134
+
135
+
136
+
137
+ /**
138
+ * Default factory to use when creating xhr objects. You probably shouldn't be
139
+ * instantiating this directly, but rather using it via goog.net.XmlHttp.
140
+ * @extends {goog.net.XmlHttpFactory}
141
+ * @constructor
142
+ */
143
+ goog.net.DefaultXmlHttpFactory = function() {
144
+ goog.net.XmlHttpFactory.call(this);
145
+ };
146
+ goog.inherits(goog.net.DefaultXmlHttpFactory, goog.net.XmlHttpFactory);
147
+
148
+
149
+ /** @override */
150
+ goog.net.DefaultXmlHttpFactory.prototype.createInstance = function() {
151
+ var progId = this.getProgId_();
152
+ if (progId) {
153
+ return new ActiveXObject(progId);
154
+ } else {
155
+ return new XMLHttpRequest();
156
+ }
157
+ };
158
+
159
+
160
+ /** @override */
161
+ goog.net.DefaultXmlHttpFactory.prototype.internalGetOptions = function() {
162
+ var progId = this.getProgId_();
163
+ var options = {};
164
+ if (progId) {
165
+ options[goog.net.XmlHttp.OptionType.USE_NULL_FUNCTION] = true;
166
+ options[goog.net.XmlHttp.OptionType.LOCAL_REQUEST_ERROR] = true;
167
+ }
168
+ return options;
169
+ };
170
+
171
+
172
+ /**
173
+ * The ActiveX PROG ID string to use to create xhr's in IE. Lazily initialized.
174
+ * @type {?string}
175
+ * @private
176
+ */
177
+ goog.net.DefaultXmlHttpFactory.prototype.ieProgId_ = null;
178
+
179
+
180
+ /**
181
+ * Initialize the private state used by other functions.
182
+ * @return {string} The ActiveX PROG ID string to use to create xhr's in IE.
183
+ * @private
184
+ */
185
+ goog.net.DefaultXmlHttpFactory.prototype.getProgId_ = function() {
186
+ // The following blog post describes what PROG IDs to use to create the
187
+ // XMLHTTP object in Internet Explorer:
188
+ // http://blogs.msdn.com/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx
189
+ // However we do not (yet) fully trust that this will be OK for old versions
190
+ // of IE on Win9x so we therefore keep the last 2.
191
+ if (!this.ieProgId_ && typeof XMLHttpRequest == 'undefined' &&
192
+ typeof ActiveXObject != 'undefined') {
193
+ // Candidate Active X types.
194
+ var ACTIVE_X_IDENTS = ['MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.3.0',
195
+ 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
196
+ for (var i = 0; i < ACTIVE_X_IDENTS.length; i++) {
197
+ var candidate = ACTIVE_X_IDENTS[i];
198
+ /** @preserveTry */
199
+ try {
200
+ new ActiveXObject(candidate);
201
+ // NOTE(user): cannot assign progid and return candidate in one line
202
+ // because JSCompiler complaings: BUG 658126
203
+ this.ieProgId_ = candidate;
204
+ return candidate;
205
+ } catch (e) {
206
+ // do nothing; try next choice
207
+ }
208
+ }
209
+
210
+ // couldn't find any matches
211
+ throw Error('Could not create ActiveXObject. ActiveX might be disabled,' +
212
+ ' or MSXML might not be installed');
213
+ }
214
+
215
+ return /** @type {string} */ (this.ieProgId_);
216
+ };
217
+
218
+
219
+ //Set the global factory to an instance of the default factory.
220
+ goog.net.XmlHttp.setGlobalFactory(new goog.net.DefaultXmlHttpFactory());
221
+ ;
222
+ FI"
223
+ F"%79ddee60322673256b9c6eecf2917fa0
@@ -0,0 +1,53 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325458072.2806468: @value{ I" length:EFi'I" digest;
2
+ F"%7a6497e7495bae188e28a192999ef59eI" source;
3
+ FI"'// Copyright 2009 The Closure Library Authors. All Rights Reserved.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS-IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+
17
+ /**
18
+ * @fileoverview Provides a base class for custom Error objects such that the
19
+ * stack is correctly maintained.
20
+ *
21
+ * You should never need to throw goog.debug.Error(msg) directly, Error(msg) is
22
+ * sufficient.
23
+ *
24
+ */
25
+
26
+
27
+ goog.provide('goog.debug.Error');
28
+
29
+
30
+
31
+ /**
32
+ * Base class for custom error objects.
33
+ * @param {*=} opt_msg The message associated with the error.
34
+ * @constructor
35
+ * @extends {Error}
36
+ */
37
+ goog.debug.Error = function(opt_msg) {
38
+
39
+ // Ensure there is a stack trace.
40
+ this.stack = new Error().stack || '';
41
+
42
+ if (opt_msg) {
43
+ this.message = String(opt_msg);
44
+ }
45
+ };
46
+ goog.inherits(goog.debug.Error, Error);
47
+
48
+
49
+ /** @override */
50
+ goog.debug.Error.prototype.name = 'CustomError';
51
+ ;
52
+ FI"
53
+ F"%2f1815b0e4e5ea5e0b5f69f0316dbce9
@@ -0,0 +1,1278 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325183043.340548: @value{I"
2
+ class:EFI"BundledAsset;
3
+ FI"id;
4
+ F"%67fd3ca00b05812bf47393ee5aa4707bI"logical_path;
5
+ FI""closure/goog/string/string.js;
6
+ TI"
7
+ F"o/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/string/string.jsI"content_type;
8
+ FI"application/javascript;
9
+ FI"
10
+ mtime;
11
+ FI"2011-12-29T17:43:13+00:00;
12
+ FI" body;
13
+ FI"p�// Copyright 2006 The Closure Library Authors. All Rights Reserved.
14
+ //
15
+ // Licensed under the Apache License, Version 2.0 (the "License");
16
+ // you may not use this file except in compliance with the License.
17
+ // You may obtain a copy of the License at
18
+ //
19
+ // http://www.apache.org/licenses/LICENSE-2.0
20
+ //
21
+ // Unless required by applicable law or agreed to in writing, software
22
+ // distributed under the License is distributed on an "AS-IS" BASIS,
23
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ // See the License for the specific language governing permissions and
25
+ // limitations under the License.
26
+
27
+ /**
28
+ * @fileoverview Utilities for string manipulation.
29
+ */
30
+
31
+
32
+ /**
33
+ * Namespace for string utilities
34
+ */
35
+
36
+
37
+ goog.provide('goog.string');
38
+ goog.provide('goog.string.Unicode');
39
+
40
+
41
+ /**
42
+ * Common Unicode string characters.
43
+ * @enum {string}
44
+ */
45
+ goog.string.Unicode = {
46
+ NBSP: '\xa0'
47
+ };
48
+
49
+
50
+ /**
51
+ * Fast prefix-checker.
52
+ * @param {string} str The string to check.
53
+ * @param {string} prefix A string to look for at the start of {@code str}.
54
+ * @return {boolean} True if {@code str} begins with {@code prefix}.
55
+ */
56
+ goog.string.startsWith = function(str, prefix) {
57
+ return str.lastIndexOf(prefix, 0) == 0;
58
+ };
59
+
60
+
61
+ /**
62
+ * Fast suffix-checker.
63
+ * @param {string} str The string to check.
64
+ * @param {string} suffix A string to look for at the end of {@code str}.
65
+ * @return {boolean} True if {@code str} ends with {@code suffix}.
66
+ */
67
+ goog.string.endsWith = function(str, suffix) {
68
+ var l = str.length - suffix.length;
69
+ return l >= 0 && str.indexOf(suffix, l) == l;
70
+ };
71
+
72
+
73
+ /**
74
+ * Case-insensitive prefix-checker.
75
+ * @param {string} str The string to check.
76
+ * @param {string} prefix A string to look for at the end of {@code str}.
77
+ * @return {boolean} True if {@code str} begins with {@code prefix} (ignoring
78
+ * case).
79
+ */
80
+ goog.string.caseInsensitiveStartsWith = function(str, prefix) {
81
+ return goog.string.caseInsensitiveCompare(
82
+ prefix, str.substr(0, prefix.length)) == 0;
83
+ };
84
+
85
+
86
+ /**
87
+ * Case-insensitive suffix-checker.
88
+ * @param {string} str The string to check.
89
+ * @param {string} suffix A string to look for at the end of {@code str}.
90
+ * @return {boolean} True if {@code str} ends with {@code suffix} (ignoring
91
+ * case).
92
+ */
93
+ goog.string.caseInsensitiveEndsWith = function(str, suffix) {
94
+ return goog.string.caseInsensitiveCompare(
95
+ suffix, str.substr(str.length - suffix.length, suffix.length)) == 0;
96
+ };
97
+
98
+
99
+ /**
100
+ * Does simple python-style string substitution.
101
+ * subs("foo%s hot%s", "bar", "dog") becomes "foobar hotdog".
102
+ * @param {string} str The string containing the pattern.
103
+ * @param {...*} var_args The items to substitute into the pattern.
104
+ * @return {string} A copy of {@code str} in which each occurrence of
105
+ * {@code %s} has been replaced an argument from {@code var_args}.
106
+ */
107
+ goog.string.subs = function(str, var_args) {
108
+ // This appears to be slow, but testing shows it compares more or less
109
+ // equivalent to the regex.exec method.
110
+ for (var i = 1; i < arguments.length; i++) {
111
+ // We cast to String in case an argument is a Function. Replacing $&, for
112
+ // example, with $$$& stops the replace from subsituting the whole match
113
+ // into the resultant string. $$$& in the first replace becomes $$& in the
114
+ // second, which leaves $& in the resultant string. Also:
115
+ // $$, $`, $', $n $nn
116
+ var replacement = String(arguments[i]).replace(/\$/g, '$$$$');
117
+ str = str.replace(/\%s/, replacement);
118
+ }
119
+ return str;
120
+ };
121
+
122
+
123
+ /**
124
+ * Converts multiple whitespace chars (spaces, non-breaking-spaces, new lines
125
+ * and tabs) to a single space, and strips leading and trailing whitespace.
126
+ * @param {string} str Input string.
127
+ * @return {string} A copy of {@code str} with collapsed whitespace.
128
+ */
129
+ goog.string.collapseWhitespace = function(str) {
130
+ // Since IE doesn't include non-breaking-space (0xa0) in their \s character
131
+ // class (as required by section 7.2 of the ECMAScript spec), we explicitly
132
+ // include it in the regexp to enforce consistent cross-browser behavior.
133
+ return str.replace(/[\s\xa0]+/g, ' ').replace(/^\s+|\s+$/g, '');
134
+ };
135
+
136
+
137
+ /**
138
+ * Checks if a string is empty or contains only whitespaces.
139
+ * @param {string} str The string to check.
140
+ * @return {boolean} True if {@code str} is empty or whitespace only.
141
+ */
142
+ goog.string.isEmpty = function(str) {
143
+ // testing length == 0 first is actually slower in all browsers (about the
144
+ // same in Opera).
145
+ // Since IE doesn't include non-breaking-space (0xa0) in their \s character
146
+ // class (as required by section 7.2 of the ECMAScript spec), we explicitly
147
+ // include it in the regexp to enforce consistent cross-browser behavior.
148
+ return /^[\s\xa0]*$/.test(str);
149
+ };
150
+
151
+
152
+ /**
153
+ * Checks if a string is null, empty or contains only whitespaces.
154
+ * @param {*} str The string to check.
155
+ * @return {boolean} True if{@code str} is null, empty, or whitespace only.
156
+ */
157
+ goog.string.isEmptySafe = function(str) {
158
+ return goog.string.isEmpty(goog.string.makeSafe(str));
159
+ };
160
+
161
+
162
+ /**
163
+ * Checks if a string is all breaking whitespace.
164
+ * @param {string} str The string to check.
165
+ * @return {boolean} Whether the string is all breaking whitespace.
166
+ */
167
+ goog.string.isBreakingWhitespace = function(str) {
168
+ return !/[^\t\n\r ]/.test(str);
169
+ };
170
+
171
+
172
+ /**
173
+ * Checks if a string contains all letters.
174
+ * @param {string} str string to check.
175
+ * @return {boolean} True if {@code str} consists entirely of letters.
176
+ */
177
+ goog.string.isAlpha = function(str) {
178
+ return !/[^a-zA-Z]/.test(str);
179
+ };
180
+
181
+
182
+ /**
183
+ * Checks if a string contains only numbers.
184
+ * @param {*} str string to check. If not a string, it will be
185
+ * casted to one.
186
+ * @return {boolean} True if {@code str} is numeric.
187
+ */
188
+ goog.string.isNumeric = function(str) {
189
+ return !/[^0-9]/.test(str);
190
+ };
191
+
192
+
193
+ /**
194
+ * Checks if a string contains only numbers or letters.
195
+ * @param {string} str string to check.
196
+ * @return {boolean} True if {@code str} is alphanumeric.
197
+ */
198
+ goog.string.isAlphaNumeric = function(str) {
199
+ return !/[^a-zA-Z0-9]/.test(str);
200
+ };
201
+
202
+
203
+ /**
204
+ * Checks if a character is a space character.
205
+ * @param {string} ch Character to check.
206
+ * @return {boolean} True if {code ch} is a space.
207
+ */
208
+ goog.string.isSpace = function(ch) {
209
+ return ch == ' ';
210
+ };
211
+
212
+
213
+ /**
214
+ * Checks if a character is a valid unicode character.
215
+ * @param {string} ch Character to check.
216
+ * @return {boolean} True if {code ch} is a valid unicode character.
217
+ */
218
+ goog.string.isUnicodeChar = function(ch) {
219
+ return ch.length == 1 && ch >= ' ' && ch <= '~' ||
220
+ ch >= '\u0080' && ch <= '\uFFFD';
221
+ };
222
+
223
+
224
+ /**
225
+ * Takes a string and replaces newlines with a space. Multiple lines are
226
+ * replaced with a single space.
227
+ * @param {string} str The string from which to strip newlines.
228
+ * @return {string} A copy of {@code str} stripped of newlines.
229
+ */
230
+ goog.string.stripNewlines = function(str) {
231
+ return str.replace(/(\r\n|\r|\n)+/g, ' ');
232
+ };
233
+
234
+
235
+ /**
236
+ * Replaces Windows and Mac new lines with unix style: \r or \r\n with \n.
237
+ * @param {string} str The string to in which to canonicalize newlines.
238
+ * @return {string} {@code str} A copy of {@code} with canonicalized newlines.
239
+ */
240
+ goog.string.canonicalizeNewlines = function(str) {
241
+ return str.replace(/(\r\n|\r|\n)/g, '\n');
242
+ };
243
+
244
+
245
+ /**
246
+ * Normalizes whitespace in a string, replacing all whitespace chars with
247
+ * a space.
248
+ * @param {string} str The string in which to normalize whitespace.
249
+ * @return {string} A copy of {@code str} with all whitespace normalized.
250
+ */
251
+ goog.string.normalizeWhitespace = function(str) {
252
+ return str.replace(/\xa0|\s/g, ' ');
253
+ };
254
+
255
+
256
+ /**
257
+ * Normalizes spaces in a string, replacing all consecutive spaces and tabs
258
+ * with a single space. Replaces non-breaking space with a space.
259
+ * @param {string} str The string in which to normalize spaces.
260
+ * @return {string} A copy of {@code str} with all consecutive spaces and tabs
261
+ * replaced with a single space.
262
+ */
263
+ goog.string.normalizeSpaces = function(str) {
264
+ return str.replace(/\xa0|[ \t]+/g, ' ');
265
+ };
266
+
267
+
268
+ /**
269
+ * Removes the breaking spaces from the left and right of the string and
270
+ * collapses the sequences of breaking spaces in the middle into single spaces.
271
+ * The original and the result strings render the same way in HTML.
272
+ * @param {string} str A string in which to collapse spaces.
273
+ * @return {string} Copy of the string with normalized breaking spaces.
274
+ */
275
+ goog.string.collapseBreakingSpaces = function(str) {
276
+ return str.replace(/[\t\r\n ]+/g, ' ').replace(
277
+ /^[\t\r\n ]+|[\t\r\n ]+$/g, '');
278
+ };
279
+
280
+
281
+ /**
282
+ * Trims white spaces to the left and right of a string.
283
+ * @param {string} str The string to trim.
284
+ * @return {string} A trimmed copy of {@code str}.
285
+ */
286
+ goog.string.trim = function(str) {
287
+ // Since IE doesn't include non-breaking-space (0xa0) in their \s character
288
+ // class (as required by section 7.2 of the ECMAScript spec), we explicitly
289
+ // include it in the regexp to enforce consistent cross-browser behavior.
290
+ return str.replace(/^[\s\xa0]+|[\s\xa0]+$/g, '');
291
+ };
292
+
293
+
294
+ /**
295
+ * Trims whitespaces at the left end of a string.
296
+ * @param {string} str The string to left trim.
297
+ * @return {string} A trimmed copy of {@code str}.
298
+ */
299
+ goog.string.trimLeft = function(str) {
300
+ // Since IE doesn't include non-breaking-space (0xa0) in their \s character
301
+ // class (as required by section 7.2 of the ECMAScript spec), we explicitly
302
+ // include it in the regexp to enforce consistent cross-browser behavior.
303
+ return str.replace(/^[\s\xa0]+/, '');
304
+ };
305
+
306
+
307
+ /**
308
+ * Trims whitespaces at the right end of a string.
309
+ * @param {string} str The string to right trim.
310
+ * @return {string} A trimmed copy of {@code str}.
311
+ */
312
+ goog.string.trimRight = function(str) {
313
+ // Since IE doesn't include non-breaking-space (0xa0) in their \s character
314
+ // class (as required by section 7.2 of the ECMAScript spec), we explicitly
315
+ // include it in the regexp to enforce consistent cross-browser behavior.
316
+ return str.replace(/[\s\xa0]+$/, '');
317
+ };
318
+
319
+
320
+ /**
321
+ * A string comparator that ignores case.
322
+ * -1 = str1 less than str2
323
+ * 0 = str1 equals str2
324
+ * 1 = str1 greater than str2
325
+ *
326
+ * @param {string} str1 The string to compare.
327
+ * @param {string} str2 The string to compare {@code str1} to.
328
+ * @return {number} The comparator result, as described above.
329
+ */
330
+ goog.string.caseInsensitiveCompare = function(str1, str2) {
331
+ var test1 = String(str1).toLowerCase();
332
+ var test2 = String(str2).toLowerCase();
333
+
334
+ if (test1 < test2) {
335
+ return -1;
336
+ } else if (test1 == test2) {
337
+ return 0;
338
+ } else {
339
+ return 1;
340
+ }
341
+ };
342
+
343
+
344
+ /**
345
+ * Regular expression used for splitting a string into substrings of fractional
346
+ * numbers, integers, and non-numeric characters.
347
+ * @type {RegExp}
348
+ * @private
349
+ */
350
+ goog.string.numerateCompareRegExp_ = /(\.\d+)|(\d+)|(\D+)/g;
351
+
352
+
353
+ /**
354
+ * String comparison function that handles numbers in a way humans might expect.
355
+ * Using this function, the string "File 2.jpg" sorts before "File 10.jpg". The
356
+ * comparison is mostly case-insensitive, though strings that are identical
357
+ * except for case are sorted with the upper-case strings before lower-case.
358
+ *
359
+ * This comparison function is significantly slower (about 500x) than either
360
+ * the default or the case-insensitive compare. It should not be used in
361
+ * time-critical code, but should be fast enough to sort several hundred short
362
+ * strings (like filenames) with a reasonable delay.
363
+ *
364
+ * @param {string} str1 The string to compare in a numerically sensitive way.
365
+ * @param {string} str2 The string to compare {@code str1} to.
366
+ * @return {number} less than 0 if str1 < str2, 0 if str1 == str2, greater than
367
+ * 0 if str1 > str2.
368
+ */
369
+ goog.string.numerateCompare = function(str1, str2) {
370
+ if (str1 == str2) {
371
+ return 0;
372
+ }
373
+ if (!str1) {
374
+ return -1;
375
+ }
376
+ if (!str2) {
377
+ return 1;
378
+ }
379
+
380
+ // Using match to split the entire string ahead of time turns out to be faster
381
+ // for most inputs than using RegExp.exec or iterating over each character.
382
+ var tokens1 = str1.toLowerCase().match(goog.string.numerateCompareRegExp_);
383
+ var tokens2 = str2.toLowerCase().match(goog.string.numerateCompareRegExp_);
384
+
385
+ var count = Math.min(tokens1.length, tokens2.length);
386
+
387
+ for (var i = 0; i < count; i++) {
388
+ var a = tokens1[i];
389
+ var b = tokens2[i];
390
+
391
+ // Compare pairs of tokens, returning if one token sorts before the other.
392
+ if (a != b) {
393
+
394
+ // Only if both tokens are integers is a special comparison required.
395
+ // Decimal numbers are sorted as strings (e.g., '.09' < '.1').
396
+ var num1 = parseInt(a, 10);
397
+ if (!isNaN(num1)) {
398
+ var num2 = parseInt(b, 10);
399
+ if (!isNaN(num2) && num1 - num2) {
400
+ return num1 - num2;
401
+ }
402
+ }
403
+ return a < b ? -1 : 1;
404
+ }
405
+ }
406
+
407
+ // If one string is a substring of the other, the shorter string sorts first.
408
+ if (tokens1.length != tokens2.length) {
409
+ return tokens1.length - tokens2.length;
410
+ }
411
+
412
+ // The two strings must be equivalent except for case (perfect equality is
413
+ // tested at the head of the function.) Revert to default ASCII-betical string
414
+ // comparison to stablize the sort.
415
+ return str1 < str2 ? -1 : 1;
416
+ };
417
+
418
+
419
+ /**
420
+ * Regular expression used for determining if a string needs to be encoded.
421
+ * @type {RegExp}
422
+ * @private
423
+ */
424
+ goog.string.encodeUriRegExp_ = /^[a-zA-Z0-9\-_.!~*'()]*$/;
425
+
426
+
427
+ /**
428
+ * URL-encodes a string
429
+ * @param {*} str The string to url-encode.
430
+ * @return {string} An encoded copy of {@code str} that is safe for urls.
431
+ * Note that '#', ':', and other characters used to delimit portions
432
+ * of URLs *will* be encoded.
433
+ */
434
+ goog.string.urlEncode = function(str) {
435
+ str = String(str);
436
+ // Checking if the search matches before calling encodeURIComponent avoids an
437
+ // extra allocation in IE6. This adds about 10us time in FF and a similiar
438
+ // over head in IE6 for lower working set apps, but for large working set
439
+ // apps like Gmail, it saves about 70us per call.
440
+ if (!goog.string.encodeUriRegExp_.test(str)) {
441
+ return encodeURIComponent(str);
442
+ }
443
+ return str;
444
+ };
445
+
446
+
447
+ /**
448
+ * URL-decodes the string. We need to specially handle '+'s because
449
+ * the javascript library doesn't convert them to spaces.
450
+ * @param {string} str The string to url decode.
451
+ * @return {string} The decoded {@code str}.
452
+ */
453
+ goog.string.urlDecode = function(str) {
454
+ return decodeURIComponent(str.replace(/\+/g, ' '));
455
+ };
456
+
457
+
458
+ /**
459
+ * Converts \n to <br>s or <br />s.
460
+ * @param {string} str The string in which to convert newlines.
461
+ * @param {boolean=} opt_xml Whether to use XML compatible tags.
462
+ * @return {string} A copy of {@code str} with converted newlines.
463
+ */
464
+ goog.string.newLineToBr = function(str, opt_xml) {
465
+ return str.replace(/(\r\n|\r|\n)/g, opt_xml ? '<br />' : '<br>');
466
+ };
467
+
468
+
469
+ /**
470
+ * Escape double quote '"' characters in addition to '&', '<', and '>' so that a
471
+ * string can be included in an HTML tag attribute value within double quotes.
472
+ *
473
+ * It should be noted that > doesn't need to be escaped for the HTML or XML to
474
+ * be valid, but it has been decided to escape it for consistency with other
475
+ * implementations.
476
+ *
477
+ * NOTE(user):
478
+ * HtmlEscape is often called during the generation of large blocks of HTML.
479
+ * Using statics for the regular expressions and strings is an optimization
480
+ * that can more than half the amount of time IE spends in this function for
481
+ * large apps, since strings and regexes both contribute to GC allocations.
482
+ *
483
+ * Testing for the presence of a character before escaping increases the number
484
+ * of function calls, but actually provides a speed increase for the average
485
+ * case -- since the average case often doesn't require the escaping of all 4
486
+ * characters and indexOf() is much cheaper than replace().
487
+ * The worst case does suffer slightly from the additional calls, therefore the
488
+ * opt_isLikelyToContainHtmlChars option has been included for situations
489
+ * where all 4 HTML entities are very likely to be present and need escaping.
490
+ *
491
+ * Some benchmarks (times tended to fluctuate +-0.05ms):
492
+ * FireFox IE6
493
+ * (no chars / average (mix of cases) / all 4 chars)
494
+ * no checks 0.13 / 0.22 / 0.22 0.23 / 0.53 / 0.80
495
+ * indexOf 0.08 / 0.17 / 0.26 0.22 / 0.54 / 0.84
496
+ * indexOf + re test 0.07 / 0.17 / 0.28 0.19 / 0.50 / 0.85
497
+ *
498
+ * An additional advantage of checking if replace actually needs to be called
499
+ * is a reduction in the number of object allocations, so as the size of the
500
+ * application grows the difference between the various methods would increase.
501
+ *
502
+ * @param {string} str string to be escaped.
503
+ * @param {boolean=} opt_isLikelyToContainHtmlChars Don't perform a check to see
504
+ * if the character needs replacing - use this option if you expect each of
505
+ * the characters to appear often. Leave false if you expect few html
506
+ * characters to occur in your strings, such as if you are escaping HTML.
507
+ * @return {string} An escaped copy of {@code str}.
508
+ */
509
+ goog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) {
510
+
511
+ if (opt_isLikelyToContainHtmlChars) {
512
+ return str.replace(goog.string.amperRe_, '&amp;')
513
+ .replace(goog.string.ltRe_, '&lt;')
514
+ .replace(goog.string.gtRe_, '&gt;')
515
+ .replace(goog.string.quotRe_, '&quot;');
516
+
517
+ } else {
518
+ // quick test helps in the case when there are no chars to replace, in
519
+ // worst case this makes barely a difference to the time taken
520
+ if (!goog.string.allRe_.test(str)) return str;
521
+
522
+ // str.indexOf is faster than regex.test in this case
523
+ if (str.indexOf('&') != -1) {
524
+ str = str.replace(goog.string.amperRe_, '&amp;');
525
+ }
526
+ if (str.indexOf('<') != -1) {
527
+ str = str.replace(goog.string.ltRe_, '&lt;');
528
+ }
529
+ if (str.indexOf('>') != -1) {
530
+ str = str.replace(goog.string.gtRe_, '&gt;');
531
+ }
532
+ if (str.indexOf('"') != -1) {
533
+ str = str.replace(goog.string.quotRe_, '&quot;');
534
+ }
535
+ return str;
536
+ }
537
+ };
538
+
539
+
540
+ /**
541
+ * Regular expression that matches an ampersand, for use in escaping.
542
+ * @type {RegExp}
543
+ * @private
544
+ */
545
+ goog.string.amperRe_ = /&/g;
546
+
547
+
548
+ /**
549
+ * Regular expression that matches a less than sign, for use in escaping.
550
+ * @type {RegExp}
551
+ * @private
552
+ */
553
+ goog.string.ltRe_ = /</g;
554
+
555
+
556
+ /**
557
+ * Regular expression that matches a greater than sign, for use in escaping.
558
+ * @type {RegExp}
559
+ * @private
560
+ */
561
+ goog.string.gtRe_ = />/g;
562
+
563
+
564
+ /**
565
+ * Regular expression that matches a double quote, for use in escaping.
566
+ * @type {RegExp}
567
+ * @private
568
+ */
569
+ goog.string.quotRe_ = /\"/g;
570
+
571
+
572
+ /**
573
+ * Regular expression that matches any character that needs to be escaped.
574
+ * @type {RegExp}
575
+ * @private
576
+ */
577
+ goog.string.allRe_ = /[&<>\"]/;
578
+
579
+
580
+ /**
581
+ * Unescapes an HTML string.
582
+ *
583
+ * @param {string} str The string to unescape.
584
+ * @return {string} An unescaped copy of {@code str}.
585
+ */
586
+ goog.string.unescapeEntities = function(str) {
587
+ if (goog.string.contains(str, '&')) {
588
+ // We are careful not to use a DOM if we do not have one. We use the []
589
+ // notation so that the JSCompiler will not complain about these objects and
590
+ // fields in the case where we have no DOM.
591
+ if ('document' in goog.global) {
592
+ return goog.string.unescapeEntitiesUsingDom_(str);
593
+ } else {
594
+ // Fall back on pure XML entities
595
+ return goog.string.unescapePureXmlEntities_(str);
596
+ }
597
+ }
598
+ return str;
599
+ };
600
+
601
+
602
+ /**
603
+ * Unescapes an HTML string using a DOM to resolve non-XML, non-numeric
604
+ * entities. This function is XSS-safe and whitespace-preserving.
605
+ * @private
606
+ * @param {string} str The string to unescape.
607
+ * @return {string} The unescaped {@code str} string.
608
+ */
609
+ goog.string.unescapeEntitiesUsingDom_ = function(str) {
610
+ var seen = {'&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"'};
611
+ var div = document.createElement('div');
612
+ // Match as many valid entity characters as possible. If the actual entity
613
+ // happens to be shorter, it will still work as innerHTML will return the
614
+ // trailing characters unchanged. Since the entity characters do not include
615
+ // open angle bracket, there is no chance of XSS from the innerHTML use.
616
+ // Since no whitespace is passed to innerHTML, whitespace is preserved.
617
+ return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) {
618
+ // Check for cached entity.
619
+ var value = seen[s];
620
+ if (value) {
621
+ return value;
622
+ }
623
+ // Check for numeric entity.
624
+ if (entity.charAt(0) == '#') {
625
+ // Prefix with 0 so that hex entities (e.g. &#x10) parse as hex numbers.
626
+ var n = Number('0' + entity.substr(1));
627
+ if (!isNaN(n)) {
628
+ value = String.fromCharCode(n);
629
+ }
630
+ }
631
+ // Fall back to innerHTML otherwise.
632
+ if (!value) {
633
+ // Append a non-entity character to avoid a bug in Webkit that parses
634
+ // an invalid entity at the end of innerHTML text as the empty string.
635
+ div.innerHTML = s + ' ';
636
+ // Then remove the trailing character from the result.
637
+ value = div.firstChild.nodeValue.slice(0, -1);
638
+ }
639
+ // Cache and return.
640
+ return seen[s] = value;
641
+ });
642
+ };
643
+
644
+
645
+ /**
646
+ * Unescapes XML entities.
647
+ * @private
648
+ * @param {string} str The string to unescape.
649
+ * @return {string} An unescaped copy of {@code str}.
650
+ */
651
+ goog.string.unescapePureXmlEntities_ = function(str) {
652
+ return str.replace(/&([^;]+);/g, function(s, entity) {
653
+ switch (entity) {
654
+ case 'amp':
655
+ return '&';
656
+ case 'lt':
657
+ return '<';
658
+ case 'gt':
659
+ return '>';
660
+ case 'quot':
661
+ return '"';
662
+ default:
663
+ if (entity.charAt(0) == '#') {
664
+ // Prefix with 0 so that hex entities (e.g. &#x10) parse as hex.
665
+ var n = Number('0' + entity.substr(1));
666
+ if (!isNaN(n)) {
667
+ return String.fromCharCode(n);
668
+ }
669
+ }
670
+ // For invalid entities we just return the entity
671
+ return s;
672
+ }
673
+ });
674
+ };
675
+
676
+
677
+ /**
678
+ * Regular expression that matches an HTML entity.
679
+ * See also HTML5: Tokenization / Tokenizing character references.
680
+ * @private
681
+ * @type {!RegExp}
682
+ */
683
+ goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g;
684
+
685
+
686
+ /**
687
+ * Do escaping of whitespace to preserve spatial formatting. We use character
688
+ * entity #160 to make it safer for xml.
689
+ * @param {string} str The string in which to escape whitespace.
690
+ * @param {boolean=} opt_xml Whether to use XML compatible tags.
691
+ * @return {string} An escaped copy of {@code str}.
692
+ */
693
+ goog.string.whitespaceEscape = function(str, opt_xml) {
694
+ return goog.string.newLineToBr(str.replace(/ /g, ' &#160;'), opt_xml);
695
+ };
696
+
697
+
698
+ /**
699
+ * Strip quote characters around a string. The second argument is a string of
700
+ * characters to treat as quotes. This can be a single character or a string of
701
+ * multiple character and in that case each of those are treated as possible
702
+ * quote characters. For example:
703
+ *
704
+ * <pre>
705
+ * goog.string.stripQuotes('"abc"', '"`') --> 'abc'
706
+ * goog.string.stripQuotes('`abc`', '"`') --> 'abc'
707
+ * </pre>
708
+ *
709
+ * @param {string} str The string to strip.
710
+ * @param {string} quoteChars The quote characters to strip.
711
+ * @return {string} A copy of {@code str} without the quotes.
712
+ */
713
+ goog.string.stripQuotes = function(str, quoteChars) {
714
+ var length = quoteChars.length;
715
+ for (var i = 0; i < length; i++) {
716
+ var quoteChar = length == 1 ? quoteChars : quoteChars.charAt(i);
717
+ if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) {
718
+ return str.substring(1, str.length - 1);
719
+ }
720
+ }
721
+ return str;
722
+ };
723
+
724
+
725
+ /**
726
+ * Truncates a string to a certain length and adds '...' if necessary. The
727
+ * length also accounts for the ellipsis, so a maximum length of 10 and a string
728
+ * 'Hello World!' produces 'Hello W...'.
729
+ * @param {string} str The string to truncate.
730
+ * @param {number} chars Max number of characters.
731
+ * @param {boolean=} opt_protectEscapedCharacters Whether to protect escaped
732
+ * characters from being cut off in the middle.
733
+ * @return {string} The truncated {@code str} string.
734
+ */
735
+ goog.string.truncate = function(str, chars, opt_protectEscapedCharacters) {
736
+ if (opt_protectEscapedCharacters) {
737
+ str = goog.string.unescapeEntities(str);
738
+ }
739
+
740
+ if (str.length > chars) {
741
+ str = str.substring(0, chars - 3) + '...';
742
+ }
743
+
744
+ if (opt_protectEscapedCharacters) {
745
+ str = goog.string.htmlEscape(str);
746
+ }
747
+
748
+ return str;
749
+ };
750
+
751
+
752
+ /**
753
+ * Truncate a string in the middle, adding "..." if necessary,
754
+ * and favoring the beginning of the string.
755
+ * @param {string} str The string to truncate the middle of.
756
+ * @param {number} chars Max number of characters.
757
+ * @param {boolean=} opt_protectEscapedCharacters Whether to protect escaped
758
+ * characters from being cutoff in the middle.
759
+ * @param {number=} opt_trailingChars Optional number of trailing characters to
760
+ * leave at the end of the string, instead of truncating as close to the
761
+ * middle as possible.
762
+ * @return {string} A truncated copy of {@code str}.
763
+ */
764
+ goog.string.truncateMiddle = function(str, chars,
765
+ opt_protectEscapedCharacters, opt_trailingChars) {
766
+ if (opt_protectEscapedCharacters) {
767
+ str = goog.string.unescapeEntities(str);
768
+ }
769
+
770
+ if (opt_trailingChars && str.length > chars) {
771
+ if (opt_trailingChars > chars) {
772
+ opt_trailingChars = chars;
773
+ }
774
+ var endPoint = str.length - opt_trailingChars;
775
+ var startPoint = chars - opt_trailingChars;
776
+ str = str.substring(0, startPoint) + '...' + str.substring(endPoint);
777
+ } else if (str.length > chars) {
778
+ // Favor the beginning of the string:
779
+ var half = Math.floor(chars / 2);
780
+ var endPos = str.length - half;
781
+ half += chars % 2;
782
+ str = str.substring(0, half) + '...' + str.substring(endPos);
783
+ }
784
+
785
+ if (opt_protectEscapedCharacters) {
786
+ str = goog.string.htmlEscape(str);
787
+ }
788
+
789
+ return str;
790
+ };
791
+
792
+
793
+ /**
794
+ * Special chars that need to be escaped for goog.string.quote.
795
+ * @private
796
+ * @type {Object}
797
+ */
798
+ goog.string.specialEscapeChars_ = {
799
+ '\0': '\\0',
800
+ '\b': '\\b',
801
+ '\f': '\\f',
802
+ '\n': '\\n',
803
+ '\r': '\\r',
804
+ '\t': '\\t',
805
+ '\x0B': '\\x0B', // '\v' is not supported in JScript
806
+ '"': '\\"',
807
+ '\\': '\\\\'
808
+ };
809
+
810
+
811
+ /**
812
+ * Character mappings used internally for goog.string.escapeChar.
813
+ * @private
814
+ * @type {Object}
815
+ */
816
+ goog.string.jsEscapeCache_ = {
817
+ '\'': '\\\''
818
+ };
819
+
820
+
821
+ /**
822
+ * Encloses a string in double quotes and escapes characters so that the
823
+ * string is a valid JS string.
824
+ * @param {string} s The string to quote.
825
+ * @return {string} A copy of {@code s} surrounded by double quotes.
826
+ */
827
+ goog.string.quote = function(s) {
828
+ s = String(s);
829
+ if (s.quote) {
830
+ return s.quote();
831
+ } else {
832
+ var sb = ['"'];
833
+ for (var i = 0; i < s.length; i++) {
834
+ var ch = s.charAt(i);
835
+ var cc = ch.charCodeAt(0);
836
+ sb[i + 1] = goog.string.specialEscapeChars_[ch] ||
837
+ ((cc > 31 && cc < 127) ? ch : goog.string.escapeChar(ch));
838
+ }
839
+ sb.push('"');
840
+ return sb.join('');
841
+ }
842
+ };
843
+
844
+
845
+ /**
846
+ * Takes a string and returns the escaped string for that character.
847
+ * @param {string} str The string to escape.
848
+ * @return {string} An escaped string representing {@code str}.
849
+ */
850
+ goog.string.escapeString = function(str) {
851
+ var sb = [];
852
+ for (var i = 0; i < str.length; i++) {
853
+ sb[i] = goog.string.escapeChar(str.charAt(i));
854
+ }
855
+ return sb.join('');
856
+ };
857
+
858
+
859
+ /**
860
+ * Takes a character and returns the escaped string for that character. For
861
+ * example escapeChar(String.fromCharCode(15)) -> "\\x0E".
862
+ * @param {string} c The character to escape.
863
+ * @return {string} An escaped string representing {@code c}.
864
+ */
865
+ goog.string.escapeChar = function(c) {
866
+ if (c in goog.string.jsEscapeCache_) {
867
+ return goog.string.jsEscapeCache_[c];
868
+ }
869
+
870
+ if (c in goog.string.specialEscapeChars_) {
871
+ return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c];
872
+ }
873
+
874
+ var rv = c;
875
+ var cc = c.charCodeAt(0);
876
+ if (cc > 31 && cc < 127) {
877
+ rv = c;
878
+ } else {
879
+ // tab is 9 but handled above
880
+ if (cc < 256) {
881
+ rv = '\\x';
882
+ if (cc < 16 || cc > 256) {
883
+ rv += '0';
884
+ }
885
+ } else {
886
+ rv = '\\u';
887
+ if (cc < 4096) { // \u1000
888
+ rv += '0';
889
+ }
890
+ }
891
+ rv += cc.toString(16).toUpperCase();
892
+ }
893
+
894
+ return goog.string.jsEscapeCache_[c] = rv;
895
+ };
896
+
897
+
898
+ /**
899
+ * Takes a string and creates a map (Object) in which the keys are the
900
+ * characters in the string. The value for the key is set to true. You can
901
+ * then use goog.object.map or goog.array.map to change the values.
902
+ * @param {string} s The string to build the map from.
903
+ * @return {Object} The map of characters used.
904
+ */
905
+ // TODO(arv): It seems like we should have a generic goog.array.toMap. But do
906
+ // we want a dependency on goog.array in goog.string?
907
+ goog.string.toMap = function(s) {
908
+ var rv = {};
909
+ for (var i = 0; i < s.length; i++) {
910
+ rv[s.charAt(i)] = true;
911
+ }
912
+ return rv;
913
+ };
914
+
915
+
916
+ /**
917
+ * Checks whether a string contains a given character.
918
+ * @param {string} s The string to test.
919
+ * @param {string} ss The substring to test for.
920
+ * @return {boolean} True if {@code s} contains {@code ss}.
921
+ */
922
+ goog.string.contains = function(s, ss) {
923
+ return s.indexOf(ss) != -1;
924
+ };
925
+
926
+
927
+ /**
928
+ * Returns the non-overlapping occurrences of ss in s.
929
+ * If either s or ss evalutes to false, then returns zero.
930
+ * @param {string} s The string to look in.
931
+ * @param {string} ss The string to look for.
932
+ * @return {number} Number of occurrences of ss in s.
933
+ */
934
+ goog.string.countOf = function(s, ss) {
935
+ return s && ss ? s.split(ss).length - 1 : 0;
936
+ };
937
+
938
+
939
+ /**
940
+ * Removes a substring of a specified length at a specific
941
+ * index in a string.
942
+ * @param {string} s The base string from which to remove.
943
+ * @param {number} index The index at which to remove the substring.
944
+ * @param {number} stringLength The length of the substring to remove.
945
+ * @return {string} A copy of {@code s} with the substring removed or the full
946
+ * string if nothing is removed or the input is invalid.
947
+ */
948
+ goog.string.removeAt = function(s, index, stringLength) {
949
+ var resultStr = s;
950
+ // If the index is greater or equal to 0 then remove substring
951
+ if (index >= 0 && index < s.length && stringLength > 0) {
952
+ resultStr = s.substr(0, index) +
953
+ s.substr(index + stringLength, s.length - index - stringLength);
954
+ }
955
+ return resultStr;
956
+ };
957
+
958
+
959
+ /**
960
+ * Removes the first occurrence of a substring from a string.
961
+ * @param {string} s The base string from which to remove.
962
+ * @param {string} ss The string to remove.
963
+ * @return {string} A copy of {@code s} with {@code ss} removed or the full
964
+ * string if nothing is removed.
965
+ */
966
+ goog.string.remove = function(s, ss) {
967
+ var re = new RegExp(goog.string.regExpEscape(ss), '');
968
+ return s.replace(re, '');
969
+ };
970
+
971
+
972
+ /**
973
+ * Removes all occurrences of a substring from a string.
974
+ * @param {string} s The base string from which to remove.
975
+ * @param {string} ss The string to remove.
976
+ * @return {string} A copy of {@code s} with {@code ss} removed or the full
977
+ * string if nothing is removed.
978
+ */
979
+ goog.string.removeAll = function(s, ss) {
980
+ var re = new RegExp(goog.string.regExpEscape(ss), 'g');
981
+ return s.replace(re, '');
982
+ };
983
+
984
+
985
+ /**
986
+ * Escapes characters in the string that are not safe to use in a RegExp.
987
+ * @param {*} s The string to escape. If not a string, it will be casted
988
+ * to one.
989
+ * @return {string} A RegExp safe, escaped copy of {@code s}.
990
+ */
991
+ goog.string.regExpEscape = function(s) {
992
+ return String(s).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
993
+ replace(/\x08/g, '\\x08');
994
+ };
995
+
996
+
997
+ /**
998
+ * Repeats a string n times.
999
+ * @param {string} string The string to repeat.
1000
+ * @param {number} length The number of times to repeat.
1001
+ * @return {string} A string containing {@code length} repetitions of
1002
+ * {@code string}.
1003
+ */
1004
+ goog.string.repeat = function(string, length) {
1005
+ return new Array(length + 1).join(string);
1006
+ };
1007
+
1008
+
1009
+ /**
1010
+ * Pads number to given length and optionally rounds it to a given precision.
1011
+ * For example:
1012
+ * <pre>padNumber(1.25, 2, 3) -> '01.250'
1013
+ * padNumber(1.25, 2) -> '01.25'
1014
+ * padNumber(1.25, 2, 1) -> '01.3'
1015
+ * padNumber(1.25, 0) -> '1.25'</pre>
1016
+ *
1017
+ * @param {number} num The number to pad.
1018
+ * @param {number} length The desired length.
1019
+ * @param {number=} opt_precision The desired precision.
1020
+ * @return {string} {@code num} as a string with the given options.
1021
+ */
1022
+ goog.string.padNumber = function(num, length, opt_precision) {
1023
+ var s = goog.isDef(opt_precision) ? num.toFixed(opt_precision) : String(num);
1024
+ var index = s.indexOf('.');
1025
+ if (index == -1) {
1026
+ index = s.length;
1027
+ }
1028
+ return goog.string.repeat('0', Math.max(0, length - index)) + s;
1029
+ };
1030
+
1031
+
1032
+ /**
1033
+ * Returns a string representation of the given object, with
1034
+ * null and undefined being returned as the empty string.
1035
+ *
1036
+ * @param {*} obj The object to convert.
1037
+ * @return {string} A string representation of the {@code obj}.
1038
+ */
1039
+ goog.string.makeSafe = function(obj) {
1040
+ return obj == null ? '' : String(obj);
1041
+ };
1042
+
1043
+
1044
+ /**
1045
+ * Concatenates string expressions. This is useful
1046
+ * since some browsers are very inefficient when it comes to using plus to
1047
+ * concat strings. Be careful when using null and undefined here since
1048
+ * these will not be included in the result. If you need to represent these
1049
+ * be sure to cast the argument to a String first.
1050
+ * For example:
1051
+ * <pre>buildString('a', 'b', 'c', 'd') -> 'abcd'
1052
+ * buildString(null, undefined) -> ''
1053
+ * </pre>
1054
+ * @param {...*} var_args A list of strings to concatenate. If not a string,
1055
+ * it will be casted to one.
1056
+ * @return {string} The concatenation of {@code var_args}.
1057
+ */
1058
+ goog.string.buildString = function(var_args) {
1059
+ return Array.prototype.join.call(arguments, '');
1060
+ };
1061
+
1062
+
1063
+ /**
1064
+ * Returns a string with at least 64-bits of randomness.
1065
+ *
1066
+ * Doesn't trust Javascript's random function entirely. Uses a combination of
1067
+ * random and current timestamp, and then encodes the string in base-36 to
1068
+ * make it shorter.
1069
+ *
1070
+ * @return {string} A random string, e.g. sn1s7vb4gcic.
1071
+ */
1072
+ goog.string.getRandomString = function() {
1073
+ var x = 2147483648;
1074
+ return Math.floor(Math.random() * x).toString(36) +
1075
+ Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36);
1076
+ };
1077
+
1078
+
1079
+ /**
1080
+ * Compares two version numbers.
1081
+ *
1082
+ * @param {string|number} version1 Version of first item.
1083
+ * @param {string|number} version2 Version of second item.
1084
+ *
1085
+ * @return {number} 1 if {@code version1} is higher.
1086
+ * 0 if arguments are equal.
1087
+ * -1 if {@code version2} is higher.
1088
+ */
1089
+ goog.string.compareVersions = function(version1, version2) {
1090
+ var order = 0;
1091
+ // Trim leading and trailing whitespace and split the versions into
1092
+ // subversions.
1093
+ var v1Subs = goog.string.trim(String(version1)).split('.');
1094
+ var v2Subs = goog.string.trim(String(version2)).split('.');
1095
+ var subCount = Math.max(v1Subs.length, v2Subs.length);
1096
+
1097
+ // Iterate over the subversions, as long as they appear to be equivalent.
1098
+ for (var subIdx = 0; order == 0 && subIdx < subCount; subIdx++) {
1099
+ var v1Sub = v1Subs[subIdx] || '';
1100
+ var v2Sub = v2Subs[subIdx] || '';
1101
+
1102
+ // Split the subversions into pairs of numbers and qualifiers (like 'b').
1103
+ // Two different RegExp objects are needed because they are both using
1104
+ // the 'g' flag.
1105
+ var v1CompParser = new RegExp('(\\d*)(\\D*)', 'g');
1106
+ var v2CompParser = new RegExp('(\\d*)(\\D*)', 'g');
1107
+ do {
1108
+ var v1Comp = v1CompParser.exec(v1Sub) || ['', '', ''];
1109
+ var v2Comp = v2CompParser.exec(v2Sub) || ['', '', ''];
1110
+ // Break if there are no more matches.
1111
+ if (v1Comp[0].length == 0 && v2Comp[0].length == 0) {
1112
+ break;
1113
+ }
1114
+
1115
+ // Parse the numeric part of the subversion. A missing number is
1116
+ // equivalent to 0.
1117
+ var v1CompNum = v1Comp[1].length == 0 ? 0 : parseInt(v1Comp[1], 10);
1118
+ var v2CompNum = v2Comp[1].length == 0 ? 0 : parseInt(v2Comp[1], 10);
1119
+
1120
+ // Compare the subversion components. The number has the highest
1121
+ // precedence. Next, if the numbers are equal, a subversion without any
1122
+ // qualifier is always higher than a subversion with any qualifier. Next,
1123
+ // the qualifiers are compared as strings.
1124
+ order = goog.string.compareElements_(v1CompNum, v2CompNum) ||
1125
+ goog.string.compareElements_(v1Comp[2].length == 0,
1126
+ v2Comp[2].length == 0) ||
1127
+ goog.string.compareElements_(v1Comp[2], v2Comp[2]);
1128
+ // Stop as soon as an inequality is discovered.
1129
+ } while (order == 0);
1130
+ }
1131
+
1132
+ return order;
1133
+ };
1134
+
1135
+
1136
+ /**
1137
+ * Compares elements of a version number.
1138
+ *
1139
+ * @param {string|number|boolean} left An element from a version number.
1140
+ * @param {string|number|boolean} right An element from a version number.
1141
+ *
1142
+ * @return {number} 1 if {@code left} is higher.
1143
+ * 0 if arguments are equal.
1144
+ * -1 if {@code right} is higher.
1145
+ * @private
1146
+ */
1147
+ goog.string.compareElements_ = function(left, right) {
1148
+ if (left < right) {
1149
+ return -1;
1150
+ } else if (left > right) {
1151
+ return 1;
1152
+ }
1153
+ return 0;
1154
+ };
1155
+
1156
+
1157
+ /**
1158
+ * Maximum value of #goog.string.hashCode, exclusive. 2^32.
1159
+ * @type {number}
1160
+ * @private
1161
+ */
1162
+ goog.string.HASHCODE_MAX_ = 0x100000000;
1163
+
1164
+
1165
+ /**
1166
+ * String hash function similar to java.lang.String.hashCode().
1167
+ * The hash code for a string is computed as
1168
+ * s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
1169
+ * where s[i] is the ith character of the string and n is the length of
1170
+ * the string. We mod the result to make it between 0 (inclusive) and 2^32
1171
+ * (exclusive).
1172
+ * @param {string} str A string.
1173
+ * @return {number} Hash value for {@code str}, between 0 (inclusive) and 2^32
1174
+ * (exclusive). The empty string returns 0.
1175
+ */
1176
+ goog.string.hashCode = function(str) {
1177
+ var result = 0;
1178
+ for (var i = 0; i < str.length; ++i) {
1179
+ result = 31 * result + str.charCodeAt(i);
1180
+ // Normalize to 4 byte range, 0 ... 2^32.
1181
+ result %= goog.string.HASHCODE_MAX_;
1182
+ }
1183
+ return result;
1184
+ };
1185
+
1186
+
1187
+ /**
1188
+ * The most recent unique ID. |0 is equivalent to Math.floor in this case.
1189
+ * @type {number}
1190
+ * @private
1191
+ */
1192
+ goog.string.uniqueStringCounter_ = Math.random() * 0x80000000 | 0;
1193
+
1194
+
1195
+ /**
1196
+ * Generates and returns a string which is unique in the current document.
1197
+ * This is useful, for example, to create unique IDs for DOM elements.
1198
+ * @return {string} A unique id.
1199
+ */
1200
+ goog.string.createUniqueString = function() {
1201
+ return 'goog_' + goog.string.uniqueStringCounter_++;
1202
+ };
1203
+
1204
+
1205
+ /**
1206
+ * Converts the supplied string to a number, which may be Ininity or NaN.
1207
+ * This function strips whitespace: (toNumber(' 123') === 123)
1208
+ * This function accepts scientific notation: (toNumber('1e1') === 10)
1209
+ *
1210
+ * This is better than Javascript's built-in conversions because, sadly:
1211
+ * (Number(' ') === 0) and (parseFloat('123a') === 123)
1212
+ *
1213
+ * @param {string} str The string to convert.
1214
+ * @return {number} The number the supplied string represents, or NaN.
1215
+ */
1216
+ goog.string.toNumber = function(str) {
1217
+ var num = Number(str);
1218
+ if (num == 0 && goog.string.isEmpty(str)) {
1219
+ return NaN;
1220
+ }
1221
+ return num;
1222
+ };
1223
+
1224
+
1225
+ /**
1226
+ * A memoized cache for goog.string.toCamelCase.
1227
+ * @type {Object.<string>}
1228
+ * @private
1229
+ */
1230
+ goog.string.toCamelCaseCache_ = {};
1231
+
1232
+
1233
+ /**
1234
+ * Converts a string from selector-case to camelCase (e.g. from
1235
+ * "multi-part-string" to "multiPartString"), useful for converting
1236
+ * CSS selectors and HTML dataset keys to their equivalent JS properties.
1237
+ * @param {string} str The string in selector-case form.
1238
+ * @return {string} The string in camelCase form.
1239
+ */
1240
+ goog.string.toCamelCase = function(str) {
1241
+ return goog.string.toCamelCaseCache_[str] ||
1242
+ (goog.string.toCamelCaseCache_[str] =
1243
+ String(str).replace(/\-([a-z])/g, function(all, match) {
1244
+ return match.toUpperCase();
1245
+ }));
1246
+ };
1247
+
1248
+
1249
+ /**
1250
+ * A memoized cache for goog.string.toSelectorCase.
1251
+ * @type {Object.<string>}
1252
+ * @private
1253
+ */
1254
+ goog.string.toSelectorCaseCache_ = {};
1255
+
1256
+
1257
+ /**
1258
+ * Converts a string from camelCase to selector-case (e.g. from
1259
+ * "multiPartString" to "multi-part-string"), useful for converting JS
1260
+ * style and dataset properties to equivalent CSS selectors and HTML keys.
1261
+ * @param {string} str The string in camelCase form.
1262
+ * @return {string} The string in selector-case form.
1263
+ */
1264
+ goog.string.toSelectorCase = function(str) {
1265
+ return goog.string.toSelectorCaseCache_[str] ||
1266
+ (goog.string.toSelectorCaseCache_[str] =
1267
+ String(str).replace(/([A-Z])/g, '-$1').toLowerCase());
1268
+ };
1269
+ ;
1270
+ FI"asset_paths;
1271
+ F["o/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/string/string.jsI"dependency_paths;
1272
+ F[{I" path;
1273
+ F"o/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/string/string.jsI"
1274
+ mtime;
1275
+ FIu: Time
1276
+ T: offsetiI"hexdigest;
1277
+ F"%0ff21dc4a73f6afee61652a225b63dc9I"
1278
+ F"%46dde6621c301f4928e3b34efee9e3b5