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
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,142 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325458072.956336: @value{ I" length:EFi�I" digest;
2
+ F"%733c5d21a59ae717a56b626fc71dc949I" 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 A utility class for representing two-dimensional positions.
19
+ */
20
+
21
+
22
+
23
+ goog.provide('goog.math.Coordinate');
24
+
25
+
26
+
27
+ /**
28
+ * Class for representing coordinates and positions.
29
+ * @param {number=} opt_x Left, defaults to 0.
30
+ * @param {number=} opt_y Top, defaults to 0.
31
+ * @constructor
32
+ */
33
+ goog.math.Coordinate = function(opt_x, opt_y) {
34
+ /**
35
+ * X-value
36
+ * @type {number}
37
+ */
38
+ this.x = goog.isDef(opt_x) ? opt_x : 0;
39
+
40
+ /**
41
+ * Y-value
42
+ * @type {number}
43
+ */
44
+ this.y = goog.isDef(opt_y) ? opt_y : 0;
45
+ };
46
+
47
+
48
+ /**
49
+ * Returns a new copy of the coordinate.
50
+ * @return {!goog.math.Coordinate} A clone of this coordinate.
51
+ */
52
+ goog.math.Coordinate.prototype.clone = function() {
53
+ return new goog.math.Coordinate(this.x, this.y);
54
+ };
55
+
56
+
57
+ if (goog.DEBUG) {
58
+ /**
59
+ * Returns a nice string representing the coordinate.
60
+ * @return {string} In the form (50, 73).
61
+ */
62
+ goog.math.Coordinate.prototype.toString = function() {
63
+ return '(' + this.x + ', ' + this.y + ')';
64
+ };
65
+ }
66
+
67
+
68
+ /**
69
+ * Compares coordinates for equality.
70
+ * @param {goog.math.Coordinate} a A Coordinate.
71
+ * @param {goog.math.Coordinate} b A Coordinate.
72
+ * @return {boolean} True iff the coordinates are equal, or if both are null.
73
+ */
74
+ goog.math.Coordinate.equals = function(a, b) {
75
+ if (a == b) {
76
+ return true;
77
+ }
78
+ if (!a || !b) {
79
+ return false;
80
+ }
81
+ return a.x == b.x && a.y == b.y;
82
+ };
83
+
84
+
85
+ /**
86
+ * Returns the distance between two coordinates.
87
+ * @param {!goog.math.Coordinate} a A Coordinate.
88
+ * @param {!goog.math.Coordinate} b A Coordinate.
89
+ * @return {number} The distance between {@code a} and {@code b}.
90
+ */
91
+ goog.math.Coordinate.distance = function(a, b) {
92
+ var dx = a.x - b.x;
93
+ var dy = a.y - b.y;
94
+ return Math.sqrt(dx * dx + dy * dy);
95
+ };
96
+
97
+
98
+ /**
99
+ * Returns the squared distance between two coordinates. Squared distances can
100
+ * be used for comparisons when the actual value is not required.
101
+ *
102
+ * Performance note: eliminating the square root is an optimization often used
103
+ * in lower-level languages, but the speed difference is not nearly as
104
+ * pronounced in JavaScript (only a few percent.)
105
+ *
106
+ * @param {!goog.math.Coordinate} a A Coordinate.
107
+ * @param {!goog.math.Coordinate} b A Coordinate.
108
+ * @return {number} The squared distance between {@code a} and {@code b}.
109
+ */
110
+ goog.math.Coordinate.squaredDistance = function(a, b) {
111
+ var dx = a.x - b.x;
112
+ var dy = a.y - b.y;
113
+ return dx * dx + dy * dy;
114
+ };
115
+
116
+
117
+ /**
118
+ * Returns the difference between two coordinates as a new
119
+ * goog.math.Coordinate.
120
+ * @param {!goog.math.Coordinate} a A Coordinate.
121
+ * @param {!goog.math.Coordinate} b A Coordinate.
122
+ * @return {!goog.math.Coordinate} A Coordinate representing the difference
123
+ * between {@code a} and {@code b}.
124
+ */
125
+ goog.math.Coordinate.difference = function(a, b) {
126
+ return new goog.math.Coordinate(a.x - b.x, a.y - b.y);
127
+ };
128
+
129
+
130
+ /**
131
+ * Returns the sum of two coordinates as a new goog.math.Coordinate.
132
+ * @param {!goog.math.Coordinate} a A Coordinate.
133
+ * @param {!goog.math.Coordinate} b A Coordinate.
134
+ * @return {!goog.math.Coordinate} A Coordinate representing the sum of the two
135
+ * coordinates.
136
+ */
137
+ goog.math.Coordinate.sum = function(a, b) {
138
+ return new goog.math.Coordinate(a.x + b.x, a.y + b.y);
139
+ };
140
+ ;
141
+ FI"
142
+ F"%fff55705111243d8520f0bc2328683d2
@@ -0,0 +1,1372 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325183043.257448: @value{I"
2
+ class:EFI"BundledAsset;
3
+ FI"id;
4
+ F"%bfbf319264927dfad4ad5eea35bb23e4I"logical_path;
5
+ FI" closure/goog/array/array.js;
6
+ TI"
7
+ F"m/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/array/array.jsI"content_type;
8
+ FI"application/javascript;
9
+ FI"
10
+ mtime;
11
+ FI"2011-12-29T17:43:12+00:00;
12
+ FI" body;
13
+ FI"��// 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 manipulating arrays.
29
+ *
30
+ */
31
+
32
+
33
+
34
+
35
+ goog.provide('goog.array');
36
+ goog.provide('goog.array.ArrayLike');
37
+
38
+ goog.require('goog.asserts');
39
+
40
+
41
+ /**
42
+ * @define {boolean} NATIVE_ARRAY_PROTOTYPES indicates whether the code should
43
+ * rely on Array.prototype functions, if available.
44
+ *
45
+ * The Array.prototype functions can be defined by external libraries like
46
+ * Prototype and setting this flag to false forces closure to use its own
47
+ * goog.array implementation.
48
+ *
49
+ * If your javascript can be loaded by a third party site and you are wary about
50
+ * relying on the prototype functions, specify
51
+ * "--define goog.NATIVE_ARRAY_PROTOTYPES=false" to the JSCompiler.
52
+ */
53
+ goog.NATIVE_ARRAY_PROTOTYPES = true;
54
+
55
+
56
+ /**
57
+ * @typedef {Array|NodeList|Arguments|{length: number}}
58
+ */
59
+ goog.array.ArrayLike;
60
+
61
+
62
+ /**
63
+ * Returns the last element in an array without removing it.
64
+ * @param {goog.array.ArrayLike} array The array.
65
+ * @return {*} Last item in array.
66
+ */
67
+ goog.array.peek = function(array) {
68
+ return array[array.length - 1];
69
+ };
70
+
71
+
72
+ /**
73
+ * Reference to the original {@code Array.prototype}.
74
+ * @private
75
+ */
76
+ goog.array.ARRAY_PROTOTYPE_ = Array.prototype;
77
+
78
+
79
+ // NOTE(arv): Since most of the array functions are generic it allows you to
80
+ // pass an array-like object. Strings have a length and are considered array-
81
+ // like. However, the 'in' operator does not work on strings so we cannot just
82
+ // use the array path even if the browser supports indexing into strings. We
83
+ // therefore end up splitting the string.
84
+
85
+
86
+ /**
87
+ * Returns the index of the first element of an array with a specified
88
+ * value, or -1 if the element is not present in the array.
89
+ *
90
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-indexof}
91
+ *
92
+ * @param {goog.array.ArrayLike} arr The array to be searched.
93
+ * @param {*} obj The object for which we are searching.
94
+ * @param {number=} opt_fromIndex The index at which to start the search. If
95
+ * omitted the search starts at index 0.
96
+ * @return {number} The index of the first matching array element.
97
+ */
98
+ goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES &&
99
+ goog.array.ARRAY_PROTOTYPE_.indexOf ?
100
+ function(arr, obj, opt_fromIndex) {
101
+ goog.asserts.assert(arr.length != null);
102
+
103
+ return goog.array.ARRAY_PROTOTYPE_.indexOf.call(arr, obj, opt_fromIndex);
104
+ } :
105
+ function(arr, obj, opt_fromIndex) {
106
+ var fromIndex = opt_fromIndex == null ?
107
+ 0 : (opt_fromIndex < 0 ?
108
+ Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex);
109
+
110
+ if (goog.isString(arr)) {
111
+ // Array.prototype.indexOf uses === so only strings should be found.
112
+ if (!goog.isString(obj) || obj.length != 1) {
113
+ return -1;
114
+ }
115
+ return arr.indexOf(obj, fromIndex);
116
+ }
117
+
118
+ for (var i = fromIndex; i < arr.length; i++) {
119
+ if (i in arr && arr[i] === obj)
120
+ return i;
121
+ }
122
+ return -1;
123
+ };
124
+
125
+
126
+ /**
127
+ * Returns the index of the last element of an array with a specified value, or
128
+ * -1 if the element is not present in the array.
129
+ *
130
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-lastindexof}
131
+ *
132
+ * @param {goog.array.ArrayLike} arr The array to be searched.
133
+ * @param {*} obj The object for which we are searching.
134
+ * @param {?number=} opt_fromIndex The index at which to start the search. If
135
+ * omitted the search starts at the end of the array.
136
+ * @return {number} The index of the last matching array element.
137
+ */
138
+ goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES &&
139
+ goog.array.ARRAY_PROTOTYPE_.lastIndexOf ?
140
+ function(arr, obj, opt_fromIndex) {
141
+ goog.asserts.assert(arr.length != null);
142
+
143
+ // Firefox treats undefined and null as 0 in the fromIndex argument which
144
+ // leads it to always return -1
145
+ var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
146
+ return goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(arr, obj, fromIndex);
147
+ } :
148
+ function(arr, obj, opt_fromIndex) {
149
+ var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
150
+
151
+ if (fromIndex < 0) {
152
+ fromIndex = Math.max(0, arr.length + fromIndex);
153
+ }
154
+
155
+ if (goog.isString(arr)) {
156
+ // Array.prototype.lastIndexOf uses === so only strings should be found.
157
+ if (!goog.isString(obj) || obj.length != 1) {
158
+ return -1;
159
+ }
160
+ return arr.lastIndexOf(obj, fromIndex);
161
+ }
162
+
163
+ for (var i = fromIndex; i >= 0; i--) {
164
+ if (i in arr && arr[i] === obj)
165
+ return i;
166
+ }
167
+ return -1;
168
+ };
169
+
170
+
171
+ /**
172
+ * Calls a function for each element in an array.
173
+ *
174
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-foreach}
175
+ *
176
+ * @param {goog.array.ArrayLike} arr Array or array like object over
177
+ * which to iterate.
178
+ * @param {?function(this: T, ...)} f The function to call for every element.
179
+ * This function takes 3 arguments (the element, the index and the array).
180
+ * The return value is ignored. The function is called only for indexes of
181
+ * the array which have assigned values; it is not called for indexes which
182
+ * have been deleted or which have never been assigned values.
183
+ * @param {T=} opt_obj The object to be used as the value of 'this'
184
+ * within f.
185
+ * @template T
186
+ */
187
+ goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES &&
188
+ goog.array.ARRAY_PROTOTYPE_.forEach ?
189
+ function(arr, f, opt_obj) {
190
+ goog.asserts.assert(arr.length != null);
191
+
192
+ goog.array.ARRAY_PROTOTYPE_.forEach.call(arr, f, opt_obj);
193
+ } :
194
+ function(arr, f, opt_obj) {
195
+ var l = arr.length; // must be fixed during loop... see docs
196
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
197
+ for (var i = 0; i < l; i++) {
198
+ if (i in arr2) {
199
+ f.call(opt_obj, arr2[i], i, arr);
200
+ }
201
+ }
202
+ };
203
+
204
+
205
+ /**
206
+ * Calls a function for each element in an array, starting from the last
207
+ * element rather than the first.
208
+ *
209
+ * @param {goog.array.ArrayLike} arr The array over which to iterate.
210
+ * @param {Function} f The function to call for every element. This function
211
+ * takes 3 arguments (the element, the index and the array). The return
212
+ * value is ignored.
213
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
214
+ * within f.
215
+ */
216
+ goog.array.forEachRight = function(arr, f, opt_obj) {
217
+ var l = arr.length; // must be fixed during loop... see docs
218
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
219
+ for (var i = l - 1; i >= 0; --i) {
220
+ if (i in arr2) {
221
+ f.call(opt_obj, arr2[i], i, arr);
222
+ }
223
+ }
224
+ };
225
+
226
+
227
+ /**
228
+ * Calls a function for each element in an array, and if the function returns
229
+ * true adds the element to a new array.
230
+ *
231
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-filter}
232
+ *
233
+ * @param {goog.array.ArrayLike} arr The array over which to iterate.
234
+ * @param {Function} f The function to call for every element. This function
235
+ * takes 3 arguments (the element, the index and the array) and must
236
+ * return a Boolean. If the return value is true the element is added to the
237
+ * result array. If it is false the element is not included.
238
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
239
+ * within f.
240
+ * @return {!Array} a new array in which only elements that passed the test are
241
+ * present.
242
+ */
243
+ goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES &&
244
+ goog.array.ARRAY_PROTOTYPE_.filter ?
245
+ function(arr, f, opt_obj) {
246
+ goog.asserts.assert(arr.length != null);
247
+
248
+ return goog.array.ARRAY_PROTOTYPE_.filter.call(arr, f, opt_obj);
249
+ } :
250
+ function(arr, f, opt_obj) {
251
+ var l = arr.length; // must be fixed during loop... see docs
252
+ var res = [];
253
+ var resLength = 0;
254
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
255
+ for (var i = 0; i < l; i++) {
256
+ if (i in arr2) {
257
+ var val = arr2[i]; // in case f mutates arr2
258
+ if (f.call(opt_obj, val, i, arr)) {
259
+ res[resLength++] = val;
260
+ }
261
+ }
262
+ }
263
+ return res;
264
+ };
265
+
266
+
267
+ /**
268
+ * Calls a function for each element in an array and inserts the result into a
269
+ * new array.
270
+ *
271
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-map}
272
+ *
273
+ * @param {goog.array.ArrayLike} arr The array over which to iterate.
274
+ * @param {Function} f The function to call for every element. This function
275
+ * takes 3 arguments (the element, the index and the array) and should
276
+ * return something. The result will be inserted into a new array.
277
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
278
+ * within f.
279
+ * @return {!Array} a new array with the results from f.
280
+ */
281
+ goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES &&
282
+ goog.array.ARRAY_PROTOTYPE_.map ?
283
+ function(arr, f, opt_obj) {
284
+ goog.asserts.assert(arr.length != null);
285
+
286
+ return goog.array.ARRAY_PROTOTYPE_.map.call(arr, f, opt_obj);
287
+ } :
288
+ function(arr, f, opt_obj) {
289
+ var l = arr.length; // must be fixed during loop... see docs
290
+ var res = new Array(l);
291
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
292
+ for (var i = 0; i < l; i++) {
293
+ if (i in arr2) {
294
+ res[i] = f.call(opt_obj, arr2[i], i, arr);
295
+ }
296
+ }
297
+ return res;
298
+ };
299
+
300
+
301
+ /**
302
+ * Passes every element of an array into a function and accumulates the result.
303
+ *
304
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-reduce}
305
+ *
306
+ * For example:
307
+ * var a = [1, 2, 3, 4];
308
+ * goog.array.reduce(a, function(r, v, i, arr) {return r + v;}, 0);
309
+ * returns 10
310
+ *
311
+ * @param {goog.array.ArrayLike} arr The array over which to iterate.
312
+ * @param {Function} f The function to call for every element. This function
313
+ * takes 4 arguments (the function's previous result or the initial value,
314
+ * the value of the current array element, the current array index, and the
315
+ * array itself)
316
+ * function(previousValue, currentValue, index, array).
317
+ * @param {*} val The initial value to pass into the function on the first call.
318
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
319
+ * within f.
320
+ * @return {*} Result of evaluating f repeatedly across the values of the array.
321
+ */
322
+ goog.array.reduce = function(arr, f, val, opt_obj) {
323
+ if (arr.reduce) {
324
+ if (opt_obj) {
325
+ return arr.reduce(goog.bind(f, opt_obj), val);
326
+ } else {
327
+ return arr.reduce(f, val);
328
+ }
329
+ }
330
+ var rval = val;
331
+ goog.array.forEach(arr, function(val, index) {
332
+ rval = f.call(opt_obj, rval, val, index, arr);
333
+ });
334
+ return rval;
335
+ };
336
+
337
+
338
+ /**
339
+ * Passes every element of an array into a function and accumulates the result,
340
+ * starting from the last element and working towards the first.
341
+ *
342
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-reduceright}
343
+ *
344
+ * For example:
345
+ * var a = ['a', 'b', 'c'];
346
+ * goog.array.reduceRight(a, function(r, v, i, arr) {return r + v;}, '');
347
+ * returns 'cba'
348
+ *
349
+ * @param {goog.array.ArrayLike} arr The array over which to iterate.
350
+ * @param {Function} f The function to call for every element. This function
351
+ * takes 4 arguments (the function's previous result or the initial value,
352
+ * the value of the current array element, the current array index, and the
353
+ * array itself)
354
+ * function(previousValue, currentValue, index, array).
355
+ * @param {*} val The initial value to pass into the function on the first call.
356
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
357
+ * within f.
358
+ * @return {*} Object returned as a result of evaluating f repeatedly across the
359
+ * values of the array.
360
+ */
361
+ goog.array.reduceRight = function(arr, f, val, opt_obj) {
362
+ if (arr.reduceRight) {
363
+ if (opt_obj) {
364
+ return arr.reduceRight(goog.bind(f, opt_obj), val);
365
+ } else {
366
+ return arr.reduceRight(f, val);
367
+ }
368
+ }
369
+ var rval = val;
370
+ goog.array.forEachRight(arr, function(val, index) {
371
+ rval = f.call(opt_obj, rval, val, index, arr);
372
+ });
373
+ return rval;
374
+ };
375
+
376
+
377
+ /**
378
+ * Calls f for each element of an array. If any call returns true, some()
379
+ * returns true (without checking the remaining elements). If all calls
380
+ * return false, some() returns false.
381
+ *
382
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-some}
383
+ *
384
+ * @param {goog.array.ArrayLike} arr The array to check.
385
+ * @param {Function} f The function to call for every element. This function
386
+ * takes 3 arguments (the element, the index and the array) and must
387
+ * return a Boolean.
388
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
389
+ * within f.
390
+ * @return {boolean} true if any element passes the test.
391
+ */
392
+ goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES &&
393
+ goog.array.ARRAY_PROTOTYPE_.some ?
394
+ function(arr, f, opt_obj) {
395
+ goog.asserts.assert(arr.length != null);
396
+
397
+ return goog.array.ARRAY_PROTOTYPE_.some.call(arr, f, opt_obj);
398
+ } :
399
+ function(arr, f, opt_obj) {
400
+ var l = arr.length; // must be fixed during loop... see docs
401
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
402
+ for (var i = 0; i < l; i++) {
403
+ if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
404
+ return true;
405
+ }
406
+ }
407
+ return false;
408
+ };
409
+
410
+
411
+ /**
412
+ * Call f for each element of an array. If all calls return true, every()
413
+ * returns true. If any call returns false, every() returns false and
414
+ * does not continue to check the remaining elements.
415
+ *
416
+ * See {@link http://tinyurl.com/developer-mozilla-org-array-every}
417
+ *
418
+ * @param {goog.array.ArrayLike} arr The array to check.
419
+ * @param {Function} f The function to call for every element. This function
420
+ * takes 3 arguments (the element, the index and the array) and must
421
+ * return a Boolean.
422
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
423
+ * within f.
424
+ * @return {boolean} false if any element fails the test.
425
+ */
426
+ goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES &&
427
+ goog.array.ARRAY_PROTOTYPE_.every ?
428
+ function(arr, f, opt_obj) {
429
+ goog.asserts.assert(arr.length != null);
430
+
431
+ return goog.array.ARRAY_PROTOTYPE_.every.call(arr, f, opt_obj);
432
+ } :
433
+ function(arr, f, opt_obj) {
434
+ var l = arr.length; // must be fixed during loop... see docs
435
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
436
+ for (var i = 0; i < l; i++) {
437
+ if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) {
438
+ return false;
439
+ }
440
+ }
441
+ return true;
442
+ };
443
+
444
+
445
+ /**
446
+ * Search an array for the first element that satisfies a given condition and
447
+ * return that element.
448
+ * @param {goog.array.ArrayLike} arr The array to search.
449
+ * @param {Function} f The function to call for every element. This function
450
+ * takes 3 arguments (the element, the index and the array) and should
451
+ * return a boolean.
452
+ * @param {Object=} opt_obj An optional "this" context for the function.
453
+ * @return {*} The first array element that passes the test, or null if no
454
+ * element is found.
455
+ */
456
+ goog.array.find = function(arr, f, opt_obj) {
457
+ var i = goog.array.findIndex(arr, f, opt_obj);
458
+ return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
459
+ };
460
+
461
+
462
+ /**
463
+ * Search an array for the first element that satisfies a given condition and
464
+ * return its index.
465
+ * @param {goog.array.ArrayLike} arr The array to search.
466
+ * @param {Function} f The function to call for every element. This function
467
+ * takes 3 arguments (the element, the index and the array) and should
468
+ * return a boolean.
469
+ * @param {Object=} opt_obj An optional "this" context for the function.
470
+ * @return {number} The index of the first array element that passes the test,
471
+ * or -1 if no element is found.
472
+ */
473
+ goog.array.findIndex = function(arr, f, opt_obj) {
474
+ var l = arr.length; // must be fixed during loop... see docs
475
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
476
+ for (var i = 0; i < l; i++) {
477
+ if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
478
+ return i;
479
+ }
480
+ }
481
+ return -1;
482
+ };
483
+
484
+
485
+ /**
486
+ * Search an array (in reverse order) for the last element that satisfies a
487
+ * given condition and return that element.
488
+ * @param {goog.array.ArrayLike} arr The array to search.
489
+ * @param {Function} f The function to call for every element. This function
490
+ * takes 3 arguments (the element, the index and the array) and should
491
+ * return a boolean.
492
+ * @param {Object=} opt_obj An optional "this" context for the function.
493
+ * @return {*} The last array element that passes the test, or null if no
494
+ * element is found.
495
+ */
496
+ goog.array.findRight = function(arr, f, opt_obj) {
497
+ var i = goog.array.findIndexRight(arr, f, opt_obj);
498
+ return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
499
+ };
500
+
501
+
502
+ /**
503
+ * Search an array (in reverse order) for the last element that satisfies a
504
+ * given condition and return its index.
505
+ * @param {goog.array.ArrayLike} arr The array to search.
506
+ * @param {Function} f The function to call for every element. This function
507
+ * takes 3 arguments (the element, the index and the array) and should
508
+ * return a boolean.
509
+ * @param {Object=} opt_obj An optional "this" context for the function.
510
+ * @return {number} The index of the last array element that passes the test,
511
+ * or -1 if no element is found.
512
+ */
513
+ goog.array.findIndexRight = function(arr, f, opt_obj) {
514
+ var l = arr.length; // must be fixed during loop... see docs
515
+ var arr2 = goog.isString(arr) ? arr.split('') : arr;
516
+ for (var i = l - 1; i >= 0; i--) {
517
+ if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
518
+ return i;
519
+ }
520
+ }
521
+ return -1;
522
+ };
523
+
524
+
525
+ /**
526
+ * Whether the array contains the given object.
527
+ * @param {goog.array.ArrayLike} arr The array to test for the presence of the
528
+ * element.
529
+ * @param {*} obj The object for which to test.
530
+ * @return {boolean} true if obj is present.
531
+ */
532
+ goog.array.contains = function(arr, obj) {
533
+ return goog.array.indexOf(arr, obj) >= 0;
534
+ };
535
+
536
+
537
+ /**
538
+ * Whether the array is empty.
539
+ * @param {goog.array.ArrayLike} arr The array to test.
540
+ * @return {boolean} true if empty.
541
+ */
542
+ goog.array.isEmpty = function(arr) {
543
+ return arr.length == 0;
544
+ };
545
+
546
+
547
+ /**
548
+ * Clears the array.
549
+ * @param {goog.array.ArrayLike} arr Array or array like object to clear.
550
+ */
551
+ goog.array.clear = function(arr) {
552
+ // For non real arrays we don't have the magic length so we delete the
553
+ // indices.
554
+ if (!goog.isArray(arr)) {
555
+ for (var i = arr.length - 1; i >= 0; i--) {
556
+ delete arr[i];
557
+ }
558
+ }
559
+ arr.length = 0;
560
+ };
561
+
562
+
563
+ /**
564
+ * Pushes an item into an array, if it's not already in the array.
565
+ * @param {Array} arr Array into which to insert the item.
566
+ * @param {*} obj Value to add.
567
+ */
568
+ goog.array.insert = function(arr, obj) {
569
+ if (!goog.array.contains(arr, obj)) {
570
+ arr.push(obj);
571
+ }
572
+ };
573
+
574
+
575
+ /**
576
+ * Inserts an object at the given index of the array.
577
+ * @param {goog.array.ArrayLike} arr The array to modify.
578
+ * @param {*} obj The object to insert.
579
+ * @param {number=} opt_i The index at which to insert the object. If omitted,
580
+ * treated as 0. A negative index is counted from the end of the array.
581
+ */
582
+ goog.array.insertAt = function(arr, obj, opt_i) {
583
+ goog.array.splice(arr, opt_i, 0, obj);
584
+ };
585
+
586
+
587
+ /**
588
+ * Inserts at the given index of the array, all elements of another array.
589
+ * @param {goog.array.ArrayLike} arr The array to modify.
590
+ * @param {goog.array.ArrayLike} elementsToAdd The array of elements to add.
591
+ * @param {number=} opt_i The index at which to insert the object. If omitted,
592
+ * treated as 0. A negative index is counted from the end of the array.
593
+ */
594
+ goog.array.insertArrayAt = function(arr, elementsToAdd, opt_i) {
595
+ goog.partial(goog.array.splice, arr, opt_i, 0).apply(null, elementsToAdd);
596
+ };
597
+
598
+
599
+ /**
600
+ * Inserts an object into an array before a specified object.
601
+ * @param {Array} arr The array to modify.
602
+ * @param {*} obj The object to insert.
603
+ * @param {*=} opt_obj2 The object before which obj should be inserted. If obj2
604
+ * is omitted or not found, obj is inserted at the end of the array.
605
+ */
606
+ goog.array.insertBefore = function(arr, obj, opt_obj2) {
607
+ var i;
608
+ if (arguments.length == 2 || (i = goog.array.indexOf(arr, opt_obj2)) < 0) {
609
+ arr.push(obj);
610
+ } else {
611
+ goog.array.insertAt(arr, obj, i);
612
+ }
613
+ };
614
+
615
+
616
+ /**
617
+ * Removes the first occurrence of a particular value from an array.
618
+ * @param {goog.array.ArrayLike} arr Array from which to remove value.
619
+ * @param {*} obj Object to remove.
620
+ * @return {boolean} True if an element was removed.
621
+ */
622
+ goog.array.remove = function(arr, obj) {
623
+ var i = goog.array.indexOf(arr, obj);
624
+ var rv;
625
+ if ((rv = i >= 0)) {
626
+ goog.array.removeAt(arr, i);
627
+ }
628
+ return rv;
629
+ };
630
+
631
+
632
+ /**
633
+ * Removes from an array the element at index i
634
+ * @param {goog.array.ArrayLike} arr Array or array like object from which to
635
+ * remove value.
636
+ * @param {number} i The index to remove.
637
+ * @return {boolean} True if an element was removed.
638
+ */
639
+ goog.array.removeAt = function(arr, i) {
640
+ goog.asserts.assert(arr.length != null);
641
+
642
+ // use generic form of splice
643
+ // splice returns the removed items and if successful the length of that
644
+ // will be 1
645
+ return goog.array.ARRAY_PROTOTYPE_.splice.call(arr, i, 1).length == 1;
646
+ };
647
+
648
+
649
+ /**
650
+ * Removes the first value that satisfies the given condition.
651
+ * @param {goog.array.ArrayLike} arr Array from which to remove value.
652
+ * @param {Function} f The function to call for every element. This function
653
+ * takes 3 arguments (the element, the index and the array) and should
654
+ * return a boolean.
655
+ * @param {Object=} opt_obj An optional "this" context for the function.
656
+ * @return {boolean} True if an element was removed.
657
+ */
658
+ goog.array.removeIf = function(arr, f, opt_obj) {
659
+ var i = goog.array.findIndex(arr, f, opt_obj);
660
+ if (i >= 0) {
661
+ goog.array.removeAt(arr, i);
662
+ return true;
663
+ }
664
+ return false;
665
+ };
666
+
667
+
668
+ /**
669
+ * Returns a new array that is the result of joining the arguments. If arrays
670
+ * are passed then their items are added, however, if non-arrays are passed they
671
+ * will be added to the return array as is.
672
+ *
673
+ * Note that ArrayLike objects will be added as is, rather than having their
674
+ * items added.
675
+ *
676
+ * goog.array.concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
677
+ * goog.array.concat(0, [1, 2]) -> [0, 1, 2]
678
+ * goog.array.concat([1, 2], null) -> [1, 2, null]
679
+ *
680
+ * There is bug in all current versions of IE (6, 7 and 8) where arrays created
681
+ * in an iframe become corrupted soon (not immediately) after the iframe is
682
+ * destroyed. This is common if loading data via goog.net.IframeIo, for example.
683
+ * This corruption only affects the concat method which will start throwing
684
+ * Catastrophic Errors (#-2147418113).
685
+ *
686
+ * See http://endoflow.com/scratch/corrupted-arrays.html for a test case.
687
+ *
688
+ * Internally goog.array should use this, so that all methods will continue to
689
+ * work on these broken array objects.
690
+ *
691
+ * @param {...*} var_args Items to concatenate. Arrays will have each item
692
+ * added, while primitives and objects will be added as is.
693
+ * @return {!Array} The new resultant array.
694
+ */
695
+ goog.array.concat = function(var_args) {
696
+ return goog.array.ARRAY_PROTOTYPE_.concat.apply(
697
+ goog.array.ARRAY_PROTOTYPE_, arguments);
698
+ };
699
+
700
+
701
+ /**
702
+ * Does a shallow copy of an array.
703
+ * @param {goog.array.ArrayLike} arr Array or array-like object to clone.
704
+ * @return {!Array} Clone of the input array.
705
+ */
706
+ goog.array.clone = function(arr) {
707
+ if (goog.isArray(arr)) {
708
+ return goog.array.concat(/** @type {!Array} */ (arr));
709
+ } else { // array like
710
+ // Concat does not work with non arrays.
711
+ var rv = [];
712
+ for (var i = 0, len = arr.length; i < len; i++) {
713
+ rv[i] = arr[i];
714
+ }
715
+ return rv;
716
+ }
717
+ };
718
+
719
+
720
+ /**
721
+ * Converts an object to an array.
722
+ * @param {goog.array.ArrayLike} object The object to convert to an array.
723
+ * @return {!Array} The object converted into an array. If object has a
724
+ * length property, every property indexed with a non-negative number
725
+ * less than length will be included in the result. If object does not
726
+ * have a length property, an empty array will be returned.
727
+ */
728
+ goog.array.toArray = function(object) {
729
+ if (goog.isArray(object)) {
730
+ // This fixes the JS compiler warning and forces the Object to an Array type
731
+ return goog.array.concat(/** @type {!Array} */ (object));
732
+ }
733
+ // Clone what we hope to be an array-like object to an array.
734
+ // We could check isArrayLike() first, but no check we perform would be as
735
+ // reliable as simply making the call.
736
+ return goog.array.clone(/** @type {Array} */ (object));
737
+ };
738
+
739
+
740
+ /**
741
+ * Extends an array with another array, element, or "array like" object.
742
+ * This function operates 'in-place', it does not create a new Array.
743
+ *
744
+ * Example:
745
+ * var a = [];
746
+ * goog.array.extend(a, [0, 1]);
747
+ * a; // [0, 1]
748
+ * goog.array.extend(a, 2);
749
+ * a; // [0, 1, 2]
750
+ *
751
+ * @param {Array} arr1 The array to modify.
752
+ * @param {...*} var_args The elements or arrays of elements to add to arr1.
753
+ */
754
+ goog.array.extend = function(arr1, var_args) {
755
+ for (var i = 1; i < arguments.length; i++) {
756
+ var arr2 = arguments[i];
757
+ // If we have an Array or an Arguments object we can just call push
758
+ // directly.
759
+ var isArrayLike;
760
+ if (goog.isArray(arr2) ||
761
+ // Detect Arguments. ES5 says that the [[Class]] of an Arguments object
762
+ // is "Arguments" but only V8 and JSC/Safari gets this right. We instead
763
+ // detect Arguments by checking for array like and presence of "callee".
764
+ (isArrayLike = goog.isArrayLike(arr2)) &&
765
+ // The getter for callee throws an exception in strict mode
766
+ // according to section 10.6 in ES5 so check for presence instead.
767
+ arr2.hasOwnProperty('callee')) {
768
+ arr1.push.apply(arr1, arr2);
769
+
770
+ } else if (isArrayLike) {
771
+ // Otherwise loop over arr2 to prevent copying the object.
772
+ var len1 = arr1.length;
773
+ var len2 = arr2.length;
774
+ for (var j = 0; j < len2; j++) {
775
+ arr1[len1 + j] = arr2[j];
776
+ }
777
+ } else {
778
+ arr1.push(arr2);
779
+ }
780
+ }
781
+ };
782
+
783
+
784
+ /**
785
+ * Adds or removes elements from an array. This is a generic version of Array
786
+ * splice. This means that it might work on other objects similar to arrays,
787
+ * such as the arguments object.
788
+ *
789
+ * @param {goog.array.ArrayLike} arr The array to modify.
790
+ * @param {number|undefined} index The index at which to start changing the
791
+ * array. If not defined, treated as 0.
792
+ * @param {number} howMany How many elements to remove (0 means no removal. A
793
+ * value below 0 is treated as zero and so is any other non number. Numbers
794
+ * are floored).
795
+ * @param {...*} var_args Optional, additional elements to insert into the
796
+ * array.
797
+ * @return {!Array} the removed elements.
798
+ */
799
+ goog.array.splice = function(arr, index, howMany, var_args) {
800
+ goog.asserts.assert(arr.length != null);
801
+
802
+ return goog.array.ARRAY_PROTOTYPE_.splice.apply(
803
+ arr, goog.array.slice(arguments, 1));
804
+ };
805
+
806
+
807
+ /**
808
+ * Returns a new array from a segment of an array. This is a generic version of
809
+ * Array slice. This means that it might work on other objects similar to
810
+ * arrays, such as the arguments object.
811
+ *
812
+ * @param {goog.array.ArrayLike} arr The array from which to copy a segment.
813
+ * @param {number} start The index of the first element to copy.
814
+ * @param {number=} opt_end The index after the last element to copy.
815
+ * @return {!Array} A new array containing the specified segment of the original
816
+ * array.
817
+ */
818
+ goog.array.slice = function(arr, start, opt_end) {
819
+ goog.asserts.assert(arr.length != null);
820
+
821
+ // passing 1 arg to slice is not the same as passing 2 where the second is
822
+ // null or undefined (in that case the second argument is treated as 0).
823
+ // we could use slice on the arguments object and then use apply instead of
824
+ // testing the length
825
+ if (arguments.length <= 2) {
826
+ return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start);
827
+ } else {
828
+ return goog.array.ARRAY_PROTOTYPE_.slice.call(arr, start, opt_end);
829
+ }
830
+ };
831
+
832
+
833
+ /**
834
+ * Removes all duplicates from an array (retaining only the first
835
+ * occurrence of each array element). This function modifies the
836
+ * array in place and doesn't change the order of the non-duplicate items.
837
+ *
838
+ * For objects, duplicates are identified as having the same unique ID as
839
+ * defined by {@link goog.getUid}.
840
+ *
841
+ * Runtime: N,
842
+ * Worstcase space: 2N (no dupes)
843
+ *
844
+ * @param {goog.array.ArrayLike} arr The array from which to remove duplicates.
845
+ * @param {Array=} opt_rv An optional array in which to return the results,
846
+ * instead of performing the removal inplace. If specified, the original
847
+ * array will remain unchanged.
848
+ */
849
+ goog.array.removeDuplicates = function(arr, opt_rv) {
850
+ var returnArray = opt_rv || arr;
851
+
852
+ var seen = {}, cursorInsert = 0, cursorRead = 0;
853
+ while (cursorRead < arr.length) {
854
+ var current = arr[cursorRead++];
855
+
856
+ // Prefix each type with a single character representing the type to
857
+ // prevent conflicting keys (e.g. true and 'true').
858
+ var key = goog.isObject(current) ?
859
+ 'o' + goog.getUid(current) :
860
+ (typeof current).charAt(0) + current;
861
+
862
+ if (!Object.prototype.hasOwnProperty.call(seen, key)) {
863
+ seen[key] = true;
864
+ returnArray[cursorInsert++] = current;
865
+ }
866
+ }
867
+ returnArray.length = cursorInsert;
868
+ };
869
+
870
+
871
+ /**
872
+ * Searches the specified array for the specified target using the binary
873
+ * search algorithm. If no opt_compareFn is specified, elements are compared
874
+ * using <code>goog.array.defaultCompare</code>, which compares the elements
875
+ * using the built in < and > operators. This will produce the expected
876
+ * behavior for homogeneous arrays of String(s) and Number(s). The array
877
+ * specified <b>must</b> be sorted in ascending order (as defined by the
878
+ * comparison function). If the array is not sorted, results are undefined.
879
+ * If the array contains multiple instances of the specified target value, any
880
+ * of these instances may be found.
881
+ *
882
+ * Runtime: O(log n)
883
+ *
884
+ * @param {goog.array.ArrayLike} arr The array to be searched.
885
+ * @param {*} target The sought value.
886
+ * @param {Function=} opt_compareFn Optional comparison function by which the
887
+ * array is ordered. Should take 2 arguments to compare, and return a
888
+ * negative number, zero, or a positive number depending on whether the
889
+ * first argument is less than, equal to, or greater than the second.
890
+ * @return {number} Lowest index of the target value if found, otherwise
891
+ * (-(insertion point) - 1). The insertion point is where the value should
892
+ * be inserted into arr to preserve the sorted property. Return value >= 0
893
+ * iff target is found.
894
+ */
895
+ goog.array.binarySearch = function(arr, target, opt_compareFn) {
896
+ return goog.array.binarySearch_(arr,
897
+ opt_compareFn || goog.array.defaultCompare, false /* isEvaluator */,
898
+ target);
899
+ };
900
+
901
+
902
+ /**
903
+ * Selects an index in the specified array using the binary search algorithm.
904
+ * The evaluator receives an element and determines whether the desired index
905
+ * is before, at, or after it. The evaluator must be consistent (formally,
906
+ * goog.array.map(goog.array.map(arr, evaluator, opt_obj), goog.math.sign)
907
+ * must be monotonically non-increasing).
908
+ *
909
+ * Runtime: O(log n)
910
+ *
911
+ * @param {goog.array.ArrayLike} arr The array to be searched.
912
+ * @param {Function} evaluator Evaluator function that receives 3 arguments
913
+ * (the element, the index and the array). Should return a negative number,
914
+ * zero, or a positive number depending on whether the desired index is
915
+ * before, at, or after the element passed to it.
916
+ * @param {Object=} opt_obj The object to be used as the value of 'this'
917
+ * within evaluator.
918
+ * @return {number} Index of the leftmost element matched by the evaluator, if
919
+ * such exists; otherwise (-(insertion point) - 1). The insertion point is
920
+ * the index of the first element for which the evaluator returns negative,
921
+ * or arr.length if no such element exists. The return value is non-negative
922
+ * iff a match is found.
923
+ */
924
+ goog.array.binarySelect = function(arr, evaluator, opt_obj) {
925
+ return goog.array.binarySearch_(arr, evaluator, true /* isEvaluator */,
926
+ undefined /* opt_target */, opt_obj);
927
+ };
928
+
929
+
930
+ /**
931
+ * Implementation of a binary search algorithm which knows how to use both
932
+ * comparison functions and evaluators. If an evaluator is provided, will call
933
+ * the evaluator with the given optional data object, conforming to the
934
+ * interface defined in binarySelect. Otherwise, if a comparison function is
935
+ * provided, will call the comparison function against the given data object.
936
+ *
937
+ * This implementation purposefully does not use goog.bind or goog.partial for
938
+ * performance reasons.
939
+ *
940
+ * Runtime: O(log n)
941
+ *
942
+ * @param {goog.array.ArrayLike} arr The array to be searched.
943
+ * @param {Function} compareFn Either an evaluator or a comparison function,
944
+ * as defined by binarySearch and binarySelect above.
945
+ * @param {boolean} isEvaluator Whether the function is an evaluator or a
946
+ * comparison function.
947
+ * @param {*=} opt_target If the function is a comparison function, then this is
948
+ * the target to binary search for.
949
+ * @param {Object=} opt_selfObj If the function is an evaluator, this is an
950
+ * optional this object for the evaluator.
951
+ * @return {number} Lowest index of the target value if found, otherwise
952
+ * (-(insertion point) - 1). The insertion point is where the value should
953
+ * be inserted into arr to preserve the sorted property. Return value >= 0
954
+ * iff target is found.
955
+ * @private
956
+ */
957
+ goog.array.binarySearch_ = function(arr, compareFn, isEvaluator, opt_target,
958
+ opt_selfObj) {
959
+ var left = 0; // inclusive
960
+ var right = arr.length; // exclusive
961
+ var found;
962
+ while (left < right) {
963
+ var middle = (left + right) >> 1;
964
+ var compareResult;
965
+ if (isEvaluator) {
966
+ compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);
967
+ } else {
968
+ compareResult = compareFn(opt_target, arr[middle]);
969
+ }
970
+ if (compareResult > 0) {
971
+ left = middle + 1;
972
+ } else {
973
+ right = middle;
974
+ // We are looking for the lowest index so we can't return immediately.
975
+ found = !compareResult;
976
+ }
977
+ }
978
+ // left is the index if found, or the insertion point otherwise.
979
+ // ~left is a shorthand for -left - 1.
980
+ return found ? left : ~left;
981
+ };
982
+
983
+
984
+ /**
985
+ * Sorts the specified array into ascending order. If no opt_compareFn is
986
+ * specified, elements are compared using
987
+ * <code>goog.array.defaultCompare</code>, which compares the elements using
988
+ * the built in < and > operators. This will produce the expected behavior
989
+ * for homogeneous arrays of String(s) and Number(s), unlike the native sort,
990
+ * but will give unpredictable results for heterogenous lists of strings and
991
+ * numbers with different numbers of digits.
992
+ *
993
+ * This sort is not guaranteed to be stable.
994
+ *
995
+ * Runtime: Same as <code>Array.prototype.sort</code>
996
+ *
997
+ * @param {Array} arr The array to be sorted.
998
+ * @param {Function=} opt_compareFn Optional comparison function by which the
999
+ * array is to be ordered. Should take 2 arguments to compare, and return a
1000
+ * negative number, zero, or a positive number depending on whether the
1001
+ * first argument is less than, equal to, or greater than the second.
1002
+ */
1003
+ goog.array.sort = function(arr, opt_compareFn) {
1004
+ // TODO(arv): Update type annotation since null is not accepted.
1005
+ goog.asserts.assert(arr.length != null);
1006
+
1007
+ goog.array.ARRAY_PROTOTYPE_.sort.call(
1008
+ arr, opt_compareFn || goog.array.defaultCompare);
1009
+ };
1010
+
1011
+
1012
+ /**
1013
+ * Sorts the specified array into ascending order in a stable way. If no
1014
+ * opt_compareFn is specified, elements are compared using
1015
+ * <code>goog.array.defaultCompare</code>, which compares the elements using
1016
+ * the built in < and > operators. This will produce the expected behavior
1017
+ * for homogeneous arrays of String(s) and Number(s).
1018
+ *
1019
+ * Runtime: Same as <code>Array.prototype.sort</code>, plus an additional
1020
+ * O(n) overhead of copying the array twice.
1021
+ *
1022
+ * @param {Array} arr The array to be sorted.
1023
+ * @param {function(*, *): number=} opt_compareFn Optional comparison function
1024
+ * by which the array is to be ordered. Should take 2 arguments to compare,
1025
+ * and return a negative number, zero, or a positive number depending on
1026
+ * whether the first argument is less than, equal to, or greater than the
1027
+ * second.
1028
+ */
1029
+ goog.array.stableSort = function(arr, opt_compareFn) {
1030
+ for (var i = 0; i < arr.length; i++) {
1031
+ arr[i] = {index: i, value: arr[i]};
1032
+ }
1033
+ var valueCompareFn = opt_compareFn || goog.array.defaultCompare;
1034
+ function stableCompareFn(obj1, obj2) {
1035
+ return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;
1036
+ };
1037
+ goog.array.sort(arr, stableCompareFn);
1038
+ for (var i = 0; i < arr.length; i++) {
1039
+ arr[i] = arr[i].value;
1040
+ }
1041
+ };
1042
+
1043
+
1044
+ /**
1045
+ * Sorts an array of objects by the specified object key and compare
1046
+ * function. If no compare function is provided, the key values are
1047
+ * compared in ascending order using <code>goog.array.defaultCompare</code>.
1048
+ * This won't work for keys that get renamed by the compiler. So use
1049
+ * {'foo': 1, 'bar': 2} rather than {foo: 1, bar: 2}.
1050
+ * @param {Array.<Object>} arr An array of objects to sort.
1051
+ * @param {string} key The object key to sort by.
1052
+ * @param {Function=} opt_compareFn The function to use to compare key
1053
+ * values.
1054
+ */
1055
+ goog.array.sortObjectsByKey = function(arr, key, opt_compareFn) {
1056
+ var compare = opt_compareFn || goog.array.defaultCompare;
1057
+ goog.array.sort(arr, function(a, b) {
1058
+ return compare(a[key], b[key]);
1059
+ });
1060
+ };
1061
+
1062
+
1063
+ /**
1064
+ * Tells if the array is sorted.
1065
+ * @param {!Array} arr The array.
1066
+ * @param {Function=} opt_compareFn Function to compare the array elements.
1067
+ * Should take 2 arguments to compare, and return a negative number, zero,
1068
+ * or a positive number depending on whether the first argument is less
1069
+ * than, equal to, or greater than the second.
1070
+ * @param {boolean=} opt_strict If true no equal elements are allowed.
1071
+ * @return {boolean} Whether the array is sorted.
1072
+ */
1073
+ goog.array.isSorted = function(arr, opt_compareFn, opt_strict) {
1074
+ var compare = opt_compareFn || goog.array.defaultCompare;
1075
+ for (var i = 1; i < arr.length; i++) {
1076
+ var compareResult = compare(arr[i - 1], arr[i]);
1077
+ if (compareResult > 0 || compareResult == 0 && opt_strict) {
1078
+ return false;
1079
+ }
1080
+ }
1081
+ return true;
1082
+ };
1083
+
1084
+
1085
+ /**
1086
+ * Compares two arrays for equality. Two arrays are considered equal if they
1087
+ * have the same length and their corresponding elements are equal according to
1088
+ * the comparison function.
1089
+ *
1090
+ * @param {goog.array.ArrayLike} arr1 The first array to compare.
1091
+ * @param {goog.array.ArrayLike} arr2 The second array to compare.
1092
+ * @param {Function=} opt_equalsFn Optional comparison function.
1093
+ * Should take 2 arguments to compare, and return true if the arguments
1094
+ * are equal. Defaults to {@link goog.array.defaultCompareEquality} which
1095
+ * compares the elements using the built-in '===' operator.
1096
+ * @return {boolean} Whether the two arrays are equal.
1097
+ */
1098
+ goog.array.equals = function(arr1, arr2, opt_equalsFn) {
1099
+ if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) ||
1100
+ arr1.length != arr2.length) {
1101
+ return false;
1102
+ }
1103
+ var l = arr1.length;
1104
+ var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality;
1105
+ for (var i = 0; i < l; i++) {
1106
+ if (!equalsFn(arr1[i], arr2[i])) {
1107
+ return false;
1108
+ }
1109
+ }
1110
+ return true;
1111
+ };
1112
+
1113
+
1114
+ /**
1115
+ * @deprecated Use {@link goog.array.equals}.
1116
+ * @param {goog.array.ArrayLike} arr1 See {@link goog.array.equals}.
1117
+ * @param {goog.array.ArrayLike} arr2 See {@link goog.array.equals}.
1118
+ * @param {Function=} opt_equalsFn See {@link goog.array.equals}.
1119
+ * @return {boolean} See {@link goog.array.equals}.
1120
+ */
1121
+ goog.array.compare = function(arr1, arr2, opt_equalsFn) {
1122
+ return goog.array.equals(arr1, arr2, opt_equalsFn);
1123
+ };
1124
+
1125
+
1126
+ /**
1127
+ * 3-way array compare function.
1128
+ * @param {!goog.array.ArrayLike} arr1 The first array to compare.
1129
+ * @param {!goog.array.ArrayLike} arr2 The second array to compare.
1130
+ * @param {(function(*, *): number)=} opt_compareFn Optional comparison function
1131
+ * by which the array is to be ordered. Should take 2 arguments to compare,
1132
+ * and return a negative number, zero, or a positive number depending on
1133
+ * whether the first argument is less than, equal to, or greater than the
1134
+ * second.
1135
+ * @return {number} Negative number, zero, or a positive number depending on
1136
+ * whether the first argument is less than, equal to, or greater than the
1137
+ * second.
1138
+ */
1139
+ goog.array.compare3 = function(arr1, arr2, opt_compareFn) {
1140
+ var compare = opt_compareFn || goog.array.defaultCompare;
1141
+ var l = Math.min(arr1.length, arr2.length);
1142
+ for (var i = 0; i < l; i++) {
1143
+ var result = compare(arr1[i], arr2[i]);
1144
+ if (result != 0) {
1145
+ return result;
1146
+ }
1147
+ }
1148
+ return goog.array.defaultCompare(arr1.length, arr2.length);
1149
+ };
1150
+
1151
+
1152
+ /**
1153
+ * Compares its two arguments for order, using the built in < and >
1154
+ * operators.
1155
+ * @param {*} a The first object to be compared.
1156
+ * @param {*} b The second object to be compared.
1157
+ * @return {number} A negative number, zero, or a positive number as the first
1158
+ * argument is less than, equal to, or greater than the second.
1159
+ */
1160
+ goog.array.defaultCompare = function(a, b) {
1161
+ return a > b ? 1 : a < b ? -1 : 0;
1162
+ };
1163
+
1164
+
1165
+ /**
1166
+ * Compares its two arguments for equality, using the built in === operator.
1167
+ * @param {*} a The first object to compare.
1168
+ * @param {*} b The second object to compare.
1169
+ * @return {boolean} True if the two arguments are equal, false otherwise.
1170
+ */
1171
+ goog.array.defaultCompareEquality = function(a, b) {
1172
+ return a === b;
1173
+ };
1174
+
1175
+
1176
+ /**
1177
+ * Inserts a value into a sorted array. The array is not modified if the
1178
+ * value is already present.
1179
+ * @param {Array} array The array to modify.
1180
+ * @param {*} value The object to insert.
1181
+ * @param {Function=} opt_compareFn Optional comparison function by which the
1182
+ * array is ordered. Should take 2 arguments to compare, and return a
1183
+ * negative number, zero, or a positive number depending on whether the
1184
+ * first argument is less than, equal to, or greater than the second.
1185
+ * @return {boolean} True if an element was inserted.
1186
+ */
1187
+ goog.array.binaryInsert = function(array, value, opt_compareFn) {
1188
+ var index = goog.array.binarySearch(array, value, opt_compareFn);
1189
+ if (index < 0) {
1190
+ goog.array.insertAt(array, value, -(index + 1));
1191
+ return true;
1192
+ }
1193
+ return false;
1194
+ };
1195
+
1196
+
1197
+ /**
1198
+ * Removes a value from a sorted array.
1199
+ * @param {Array} array The array to modify.
1200
+ * @param {*} value The object to remove.
1201
+ * @param {Function=} opt_compareFn Optional comparison function by which the
1202
+ * array is ordered. Should take 2 arguments to compare, and return a
1203
+ * negative number, zero, or a positive number depending on whether the
1204
+ * first argument is less than, equal to, or greater than the second.
1205
+ * @return {boolean} True if an element was removed.
1206
+ */
1207
+ goog.array.binaryRemove = function(array, value, opt_compareFn) {
1208
+ var index = goog.array.binarySearch(array, value, opt_compareFn);
1209
+ return (index >= 0) ? goog.array.removeAt(array, index) : false;
1210
+ };
1211
+
1212
+
1213
+ /**
1214
+ * Splits an array into disjoint buckets according to a splitting function.
1215
+ * @param {Array} array The array.
1216
+ * @param {Function} sorter Function to call for every element. This
1217
+ * takes 3 arguments (the element, the index and the array) and must
1218
+ * return a valid object key (a string, number, etc), or undefined, if
1219
+ * that object should not be placed in a bucket.
1220
+ * @return {!Object} An object, with keys being all of the unique return values
1221
+ * of sorter, and values being arrays containing the items for
1222
+ * which the splitter returned that key.
1223
+ */
1224
+ goog.array.bucket = function(array, sorter) {
1225
+ var buckets = {};
1226
+
1227
+ for (var i = 0; i < array.length; i++) {
1228
+ var value = array[i];
1229
+ var key = sorter(value, i, array);
1230
+ if (goog.isDef(key)) {
1231
+ // Push the value to the right bucket, creating it if necessary.
1232
+ var bucket = buckets[key] || (buckets[key] = []);
1233
+ bucket.push(value);
1234
+ }
1235
+ }
1236
+
1237
+ return buckets;
1238
+ };
1239
+
1240
+
1241
+ /**
1242
+ * Returns an array consisting of the given value repeated N times.
1243
+ *
1244
+ * @param {*} value The value to repeat.
1245
+ * @param {number} n The repeat count.
1246
+ * @return {!Array.<*>} An array with the repeated value.
1247
+ */
1248
+ goog.array.repeat = function(value, n) {
1249
+ var array = [];
1250
+ for (var i = 0; i < n; i++) {
1251
+ array[i] = value;
1252
+ }
1253
+ return array;
1254
+ };
1255
+
1256
+
1257
+ /**
1258
+ * Returns an array consisting of every argument with all arrays
1259
+ * expanded in-place recursively.
1260
+ *
1261
+ * @param {...*} var_args The values to flatten.
1262
+ * @return {!Array.<*>} An array containing the flattened values.
1263
+ */
1264
+ goog.array.flatten = function(var_args) {
1265
+ var result = [];
1266
+ for (var i = 0; i < arguments.length; i++) {
1267
+ var element = arguments[i];
1268
+ if (goog.isArray(element)) {
1269
+ result.push.apply(result, goog.array.flatten.apply(null, element));
1270
+ } else {
1271
+ result.push(element);
1272
+ }
1273
+ }
1274
+ return result;
1275
+ };
1276
+
1277
+
1278
+ /**
1279
+ * Rotates an array in-place. After calling this method, the element at
1280
+ * index i will be the element previously at index (i - n) %
1281
+ * array.length, for all values of i between 0 and array.length - 1,
1282
+ * inclusive.
1283
+ *
1284
+ * For example, suppose list comprises [t, a, n, k, s]. After invoking
1285
+ * rotate(array, 1) (or rotate(array, -4)), array will comprise [s, t, a, n, k].
1286
+ *
1287
+ * @param {!Array.<*>} array The array to rotate.
1288
+ * @param {number} n The amount to rotate.
1289
+ * @return {!Array.<*>} The array.
1290
+ */
1291
+ goog.array.rotate = function(array, n) {
1292
+ goog.asserts.assert(array.length != null);
1293
+
1294
+ if (array.length) {
1295
+ n %= array.length;
1296
+ if (n > 0) {
1297
+ goog.array.ARRAY_PROTOTYPE_.unshift.apply(array, array.splice(-n, n));
1298
+ } else if (n < 0) {
1299
+ goog.array.ARRAY_PROTOTYPE_.push.apply(array, array.splice(0, -n));
1300
+ }
1301
+ }
1302
+ return array;
1303
+ };
1304
+
1305
+
1306
+ /**
1307
+ * Creates a new array for which the element at position i is an array of the
1308
+ * ith element of the provided arrays. The returned array will only be as long
1309
+ * as the shortest array provided; additional values are ignored. For example,
1310
+ * the result of zipping [1, 2] and [3, 4, 5] is [[1,3], [2, 4]].
1311
+ *
1312
+ * This is similar to the zip() function in Python. See {@link
1313
+ * http://docs.python.org/library/functions.html#zip}
1314
+ *
1315
+ * @param {...!goog.array.ArrayLike} var_args Arrays to be combined.
1316
+ * @return {!Array.<!Array>} A new array of arrays created from provided arrays.
1317
+ */
1318
+ goog.array.zip = function(var_args) {
1319
+ if (!arguments.length) {
1320
+ return [];
1321
+ }
1322
+ var result = [];
1323
+ for (var i = 0; true; i++) {
1324
+ var value = [];
1325
+ for (var j = 0; j < arguments.length; j++) {
1326
+ var arr = arguments[j];
1327
+ // If i is larger than the array length, this is the shortest array.
1328
+ if (i >= arr.length) {
1329
+ return result;
1330
+ }
1331
+ value.push(arr[i]);
1332
+ }
1333
+ result.push(value);
1334
+ }
1335
+ };
1336
+
1337
+
1338
+ /**
1339
+ * Shuffles the values in the specified array using the Fisher-Yates in-place
1340
+ * shuffle (also known as the Knuth Shuffle). By default, calls Math.random()
1341
+ * and so resets the state of that random number generator. Similarly, may reset
1342
+ * the state of the any other specified random number generator.
1343
+ *
1344
+ * Runtime: O(n)
1345
+ *
1346
+ * @param {!Array} arr The array to be shuffled.
1347
+ * @param {Function=} opt_randFn Optional random function to use for shuffling.
1348
+ * Takes no arguments, and returns a random number on the interval [0, 1).
1349
+ * Defaults to Math.random() using JavaScript's built-in Math library.
1350
+ */
1351
+ goog.array.shuffle = function(arr, opt_randFn) {
1352
+ var randFn = opt_randFn || Math.random;
1353
+
1354
+ for (var i = arr.length - 1; i > 0; i--) {
1355
+ // Choose a random array index in [0, i] (inclusive with i).
1356
+ var j = Math.floor(randFn() * (i + 1));
1357
+
1358
+ var tmp = arr[i];
1359
+ arr[i] = arr[j];
1360
+ arr[j] = tmp;
1361
+ }
1362
+ };
1363
+ ;
1364
+ FI"asset_paths;
1365
+ F["m/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/array/array.jsI"dependency_paths;
1366
+ F[{I" path;
1367
+ F"m/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/array/array.jsI"
1368
+ mtime;
1369
+ FIu: Time
1370
+ T: offsetiI"hexdigest;
1371
+ F"%fc445b29e990f038942b0cffd6d63af2I"
1372
+ F"%46dde6621c301f4928e3b34efee9e3b5