ruby_on_ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (493) hide show
  1. data/.gitignore +18 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE +22 -0
  5. data/README.md +66 -0
  6. data/Rakefile +1 -0
  7. data/lib/ruby_on_ruby.rb +5 -0
  8. data/lib/ruby_on_ruby/console.rb +7 -0
  9. data/lib/ruby_on_ruby/context.rb +33 -0
  10. data/lib/ruby_on_ruby/file_loader.rb +31 -0
  11. data/lib/ruby_on_ruby/ruby_stream.rb +27 -0
  12. data/lib/ruby_on_ruby/version.rb +3 -0
  13. data/lib/rubyonruby.rb +1 -0
  14. data/ruby_in_ruby.gemspec +19 -0
  15. data/vendor/javascripts/emscripted-ruby/lib/.document +106 -0
  16. data/vendor/javascripts/emscripted-ruby/lib/English.rb +155 -0
  17. data/vendor/javascripts/emscripted-ruby/lib/Env.rb +18 -0
  18. data/vendor/javascripts/emscripted-ruby/lib/README +96 -0
  19. data/vendor/javascripts/emscripted-ruby/lib/abbrev.rb +103 -0
  20. data/vendor/javascripts/emscripted-ruby/lib/base64.rb +133 -0
  21. data/vendor/javascripts/emscripted-ruby/lib/benchmark.rb +572 -0
  22. data/vendor/javascripts/emscripted-ruby/lib/cgi-lib.rb +272 -0
  23. data/vendor/javascripts/emscripted-ruby/lib/cgi.rb +2308 -0
  24. data/vendor/javascripts/emscripted-ruby/lib/cgi/.document +2 -0
  25. data/vendor/javascripts/emscripted-ruby/lib/cgi/session.rb +498 -0
  26. data/vendor/javascripts/emscripted-ruby/lib/cgi/session/pstore.rb +111 -0
  27. data/vendor/javascripts/emscripted-ruby/lib/complex.rb +663 -0
  28. data/vendor/javascripts/emscripted-ruby/lib/csv.rb +992 -0
  29. data/vendor/javascripts/emscripted-ruby/lib/date.rb +1767 -0
  30. data/vendor/javascripts/emscripted-ruby/lib/date/format.rb +1190 -0
  31. data/vendor/javascripts/emscripted-ruby/lib/date2.rb +5 -0
  32. data/vendor/javascripts/emscripted-ruby/lib/debug.rb +947 -0
  33. data/vendor/javascripts/emscripted-ruby/lib/delegate.rb +337 -0
  34. data/vendor/javascripts/emscripted-ruby/lib/drb.rb +2 -0
  35. data/vendor/javascripts/emscripted-ruby/lib/drb/acl.rb +146 -0
  36. data/vendor/javascripts/emscripted-ruby/lib/drb/drb.rb +1782 -0
  37. data/vendor/javascripts/emscripted-ruby/lib/drb/eq.rb +16 -0
  38. data/vendor/javascripts/emscripted-ruby/lib/drb/extserv.rb +64 -0
  39. data/vendor/javascripts/emscripted-ruby/lib/drb/extservm.rb +89 -0
  40. data/vendor/javascripts/emscripted-ruby/lib/drb/gw.rb +122 -0
  41. data/vendor/javascripts/emscripted-ruby/lib/drb/invokemethod.rb +36 -0
  42. data/vendor/javascripts/emscripted-ruby/lib/drb/observer.rb +22 -0
  43. data/vendor/javascripts/emscripted-ruby/lib/drb/ssl.rb +190 -0
  44. data/vendor/javascripts/emscripted-ruby/lib/drb/timeridconv.rb +91 -0
  45. data/vendor/javascripts/emscripted-ruby/lib/drb/unix.rb +108 -0
  46. data/vendor/javascripts/emscripted-ruby/lib/e2mmap.rb +195 -0
  47. data/vendor/javascripts/emscripted-ruby/lib/erb.rb +880 -0
  48. data/vendor/javascripts/emscripted-ruby/lib/eregex.rb +37 -0
  49. data/vendor/javascripts/emscripted-ruby/lib/fileutils.rb +1591 -0
  50. data/vendor/javascripts/emscripted-ruby/lib/finalize.rb +193 -0
  51. data/vendor/javascripts/emscripted-ruby/lib/find.rb +79 -0
  52. data/vendor/javascripts/emscripted-ruby/lib/forwardable.rb +218 -0
  53. data/vendor/javascripts/emscripted-ruby/lib/ftools.rb +261 -0
  54. data/vendor/javascripts/emscripted-ruby/lib/generator.rb +418 -0
  55. data/vendor/javascripts/emscripted-ruby/lib/getoptlong.rb +621 -0
  56. data/vendor/javascripts/emscripted-ruby/lib/getopts.rb +127 -0
  57. data/vendor/javascripts/emscripted-ruby/lib/gserver.rb +253 -0
  58. data/vendor/javascripts/emscripted-ruby/lib/importenv.rb +33 -0
  59. data/vendor/javascripts/emscripted-ruby/lib/ipaddr.rb +814 -0
  60. data/vendor/javascripts/emscripted-ruby/lib/irb.rb +346 -0
  61. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/chws.rb +33 -0
  62. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/fork.rb +39 -0
  63. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/help.rb +34 -0
  64. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/load.rb +67 -0
  65. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/nop.rb +39 -0
  66. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/pushws.rb +39 -0
  67. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/subirb.rb +43 -0
  68. data/vendor/javascripts/emscripted-ruby/lib/irb/completion.rb +205 -0
  69. data/vendor/javascripts/emscripted-ruby/lib/irb/context.rb +255 -0
  70. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/change-ws.rb +62 -0
  71. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/history.rb +110 -0
  72. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/loader.rb +120 -0
  73. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/math-mode.rb +37 -0
  74. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/multi-irb.rb +241 -0
  75. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/save-history.rb +85 -0
  76. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/tracer.rb +61 -0
  77. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/use-loader.rb +65 -0
  78. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/workspaces.rb +56 -0
  79. data/vendor/javascripts/emscripted-ruby/lib/irb/extend-command.rb +264 -0
  80. data/vendor/javascripts/emscripted-ruby/lib/irb/frame.rb +67 -0
  81. data/vendor/javascripts/emscripted-ruby/lib/irb/help.rb +33 -0
  82. data/vendor/javascripts/emscripted-ruby/lib/irb/init.rb +259 -0
  83. data/vendor/javascripts/emscripted-ruby/lib/irb/input-method.rb +120 -0
  84. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/error.rb +30 -0
  85. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/help-message +35 -0
  86. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/error.rb +27 -0
  87. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/help-message +36 -0
  88. data/vendor/javascripts/emscripted-ruby/lib/irb/locale.rb +184 -0
  89. data/vendor/javascripts/emscripted-ruby/lib/irb/notifier.rb +145 -0
  90. data/vendor/javascripts/emscripted-ruby/lib/irb/output-method.rb +85 -0
  91. data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-lex.rb +1149 -0
  92. data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-token.rb +273 -0
  93. data/vendor/javascripts/emscripted-ruby/lib/irb/slex.rb +285 -0
  94. data/vendor/javascripts/emscripted-ruby/lib/irb/version.rb +16 -0
  95. data/vendor/javascripts/emscripted-ruby/lib/irb/workspace.rb +107 -0
  96. data/vendor/javascripts/emscripted-ruby/lib/irb/ws-for-case-2.rb +15 -0
  97. data/vendor/javascripts/emscripted-ruby/lib/irb/xmp.rb +86 -0
  98. data/vendor/javascripts/emscripted-ruby/lib/jcode.rb +220 -0
  99. data/vendor/javascripts/emscripted-ruby/lib/logger.rb +703 -0
  100. data/vendor/javascripts/emscripted-ruby/lib/mailread.rb +62 -0
  101. data/vendor/javascripts/emscripted-ruby/lib/mathn.rb +308 -0
  102. data/vendor/javascripts/emscripted-ruby/lib/matrix.rb +1278 -0
  103. data/vendor/javascripts/emscripted-ruby/lib/mkmf.rb +1811 -0
  104. data/vendor/javascripts/emscripted-ruby/lib/monitor.rb +352 -0
  105. data/vendor/javascripts/emscripted-ruby/lib/mutex_m.rb +122 -0
  106. data/vendor/javascripts/emscripted-ruby/lib/net/ftp.rb +927 -0
  107. data/vendor/javascripts/emscripted-ruby/lib/net/http.rb +2277 -0
  108. data/vendor/javascripts/emscripted-ruby/lib/net/https.rb +173 -0
  109. data/vendor/javascripts/emscripted-ruby/lib/net/imap.rb +3371 -0
  110. data/vendor/javascripts/emscripted-ruby/lib/net/pop.rb +999 -0
  111. data/vendor/javascripts/emscripted-ruby/lib/net/protocol.rb +392 -0
  112. data/vendor/javascripts/emscripted-ruby/lib/net/smtp.rb +1014 -0
  113. data/vendor/javascripts/emscripted-ruby/lib/net/telnet.rb +756 -0
  114. data/vendor/javascripts/emscripted-ruby/lib/observer.rb +192 -0
  115. data/vendor/javascripts/emscripted-ruby/lib/open-uri.rb +678 -0
  116. data/vendor/javascripts/emscripted-ruby/lib/open3.rb +101 -0
  117. data/vendor/javascripts/emscripted-ruby/lib/optparse.rb +1790 -0
  118. data/vendor/javascripts/emscripted-ruby/lib/optparse/date.rb +17 -0
  119. data/vendor/javascripts/emscripted-ruby/lib/optparse/shellwords.rb +6 -0
  120. data/vendor/javascripts/emscripted-ruby/lib/optparse/time.rb +10 -0
  121. data/vendor/javascripts/emscripted-ruby/lib/optparse/uri.rb +6 -0
  122. data/vendor/javascripts/emscripted-ruby/lib/optparse/version.rb +70 -0
  123. data/vendor/javascripts/emscripted-ruby/lib/ostruct.rb +146 -0
  124. data/vendor/javascripts/emscripted-ruby/lib/parsearg.rb +87 -0
  125. data/vendor/javascripts/emscripted-ruby/lib/parsedate.rb +53 -0
  126. data/vendor/javascripts/emscripted-ruby/lib/pathname.rb +1062 -0
  127. data/vendor/javascripts/emscripted-ruby/lib/ping.rb +64 -0
  128. data/vendor/javascripts/emscripted-ruby/lib/pp.rb +654 -0
  129. data/vendor/javascripts/emscripted-ruby/lib/prettyprint.rb +896 -0
  130. data/vendor/javascripts/emscripted-ruby/lib/profile.rb +6 -0
  131. data/vendor/javascripts/emscripted-ruby/lib/profiler.rb +59 -0
  132. data/vendor/javascripts/emscripted-ruby/lib/pstore.rb +395 -0
  133. data/vendor/javascripts/emscripted-ruby/lib/racc/parser.rb +442 -0
  134. data/vendor/javascripts/emscripted-ruby/lib/rational.rb +564 -0
  135. data/vendor/javascripts/emscripted-ruby/lib/readbytes.rb +41 -0
  136. data/vendor/javascripts/emscripted-ruby/lib/resolv-replace.rb +62 -0
  137. data/vendor/javascripts/emscripted-ruby/lib/resolv.rb +2210 -0
  138. data/vendor/javascripts/emscripted-ruby/lib/rexml/attlistdecl.rb +62 -0
  139. data/vendor/javascripts/emscripted-ruby/lib/rexml/attribute.rb +185 -0
  140. data/vendor/javascripts/emscripted-ruby/lib/rexml/cdata.rb +67 -0
  141. data/vendor/javascripts/emscripted-ruby/lib/rexml/child.rb +96 -0
  142. data/vendor/javascripts/emscripted-ruby/lib/rexml/comment.rb +80 -0
  143. data/vendor/javascripts/emscripted-ruby/lib/rexml/doctype.rb +271 -0
  144. data/vendor/javascripts/emscripted-ruby/lib/rexml/document.rb +208 -0
  145. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
  146. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/dtd.rb +51 -0
  147. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/elementdecl.rb +17 -0
  148. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/entitydecl.rb +56 -0
  149. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/notationdecl.rb +39 -0
  150. data/vendor/javascripts/emscripted-ruby/lib/rexml/element.rb +1227 -0
  151. data/vendor/javascripts/emscripted-ruby/lib/rexml/encoding.rb +71 -0
  152. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/CP-1252.rb +103 -0
  153. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
  154. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ICONV.rb +22 -0
  155. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
  156. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
  157. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
  158. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
  159. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UNILE.rb +34 -0
  160. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
  161. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-16.rb +35 -0
  162. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-8.rb +18 -0
  163. data/vendor/javascripts/emscripted-ruby/lib/rexml/entity.rb +165 -0
  164. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/default.rb +109 -0
  165. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/pretty.rb +137 -0
  166. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/transitive.rb +56 -0
  167. data/vendor/javascripts/emscripted-ruby/lib/rexml/functions.rb +382 -0
  168. data/vendor/javascripts/emscripted-ruby/lib/rexml/instruction.rb +70 -0
  169. data/vendor/javascripts/emscripted-ruby/lib/rexml/light/node.rb +196 -0
  170. data/vendor/javascripts/emscripted-ruby/lib/rexml/namespace.rb +47 -0
  171. data/vendor/javascripts/emscripted-ruby/lib/rexml/node.rb +75 -0
  172. data/vendor/javascripts/emscripted-ruby/lib/rexml/output.rb +24 -0
  173. data/vendor/javascripts/emscripted-ruby/lib/rexml/parent.rb +166 -0
  174. data/vendor/javascripts/emscripted-ruby/lib/rexml/parseexception.rb +51 -0
  175. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/baseparser.rb +503 -0
  176. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/lightparser.rb +60 -0
  177. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/pullparser.rb +196 -0
  178. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/sax2parser.rb +238 -0
  179. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/streamparser.rb +46 -0
  180. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/treeparser.rb +97 -0
  181. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
  182. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/xpathparser.rb +698 -0
  183. data/vendor/javascripts/emscripted-ruby/lib/rexml/quickpath.rb +266 -0
  184. data/vendor/javascripts/emscripted-ruby/lib/rexml/rexml.rb +32 -0
  185. data/vendor/javascripts/emscripted-ruby/lib/rexml/sax2listener.rb +97 -0
  186. data/vendor/javascripts/emscripted-ruby/lib/rexml/source.rb +251 -0
  187. data/vendor/javascripts/emscripted-ruby/lib/rexml/streamlistener.rb +92 -0
  188. data/vendor/javascripts/emscripted-ruby/lib/rexml/syncenumerator.rb +33 -0
  189. data/vendor/javascripts/emscripted-ruby/lib/rexml/text.rb +344 -0
  190. data/vendor/javascripts/emscripted-ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
  191. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/relaxng.rb +559 -0
  192. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validation.rb +155 -0
  193. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validationexception.rb +9 -0
  194. data/vendor/javascripts/emscripted-ruby/lib/rexml/xmldecl.rb +119 -0
  195. data/vendor/javascripts/emscripted-ruby/lib/rexml/xmltokens.rb +18 -0
  196. data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath.rb +66 -0
  197. data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath_parser.rb +792 -0
  198. data/vendor/javascripts/emscripted-ruby/lib/rinda/rinda.rb +283 -0
  199. data/vendor/javascripts/emscripted-ruby/lib/rinda/ring.rb +271 -0
  200. data/vendor/javascripts/emscripted-ruby/lib/rinda/tuplespace.rb +642 -0
  201. data/vendor/javascripts/emscripted-ruby/lib/rss.rb +19 -0
  202. data/vendor/javascripts/emscripted-ruby/lib/rss/0.9.rb +428 -0
  203. data/vendor/javascripts/emscripted-ruby/lib/rss/1.0.rb +452 -0
  204. data/vendor/javascripts/emscripted-ruby/lib/rss/2.0.rb +111 -0
  205. data/vendor/javascripts/emscripted-ruby/lib/rss/atom.rb +749 -0
  206. data/vendor/javascripts/emscripted-ruby/lib/rss/content.rb +31 -0
  207. data/vendor/javascripts/emscripted-ruby/lib/rss/content/1.0.rb +10 -0
  208. data/vendor/javascripts/emscripted-ruby/lib/rss/content/2.0.rb +12 -0
  209. data/vendor/javascripts/emscripted-ruby/lib/rss/converter.rb +162 -0
  210. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore.rb +161 -0
  211. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/1.0.rb +13 -0
  212. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/2.0.rb +13 -0
  213. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/atom.rb +17 -0
  214. data/vendor/javascripts/emscripted-ruby/lib/rss/image.rb +193 -0
  215. data/vendor/javascripts/emscripted-ruby/lib/rss/itunes.rb +410 -0
  216. data/vendor/javascripts/emscripted-ruby/lib/rss/maker.rb +44 -0
  217. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/0.9.rb +467 -0
  218. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/1.0.rb +434 -0
  219. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/2.0.rb +223 -0
  220. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/atom.rb +172 -0
  221. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/base.rb +868 -0
  222. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/content.rb +21 -0
  223. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/dublincore.rb +124 -0
  224. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/entry.rb +163 -0
  225. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/feed.rb +429 -0
  226. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/image.rb +111 -0
  227. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/itunes.rb +242 -0
  228. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/slash.rb +33 -0
  229. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/syndication.rb +18 -0
  230. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/taxonomy.rb +118 -0
  231. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/trackback.rb +61 -0
  232. data/vendor/javascripts/emscripted-ruby/lib/rss/parser.rb +541 -0
  233. data/vendor/javascripts/emscripted-ruby/lib/rss/rexmlparser.rb +54 -0
  234. data/vendor/javascripts/emscripted-ruby/lib/rss/rss.rb +1312 -0
  235. data/vendor/javascripts/emscripted-ruby/lib/rss/slash.rb +49 -0
  236. data/vendor/javascripts/emscripted-ruby/lib/rss/syndication.rb +67 -0
  237. data/vendor/javascripts/emscripted-ruby/lib/rss/taxonomy.rb +145 -0
  238. data/vendor/javascripts/emscripted-ruby/lib/rss/trackback.rb +288 -0
  239. data/vendor/javascripts/emscripted-ruby/lib/rss/utils.rb +111 -0
  240. data/vendor/javascripts/emscripted-ruby/lib/rss/xml-stylesheet.rb +105 -0
  241. data/vendor/javascripts/emscripted-ruby/lib/rss/xml.rb +71 -0
  242. data/vendor/javascripts/emscripted-ruby/lib/rss/xmlparser.rb +93 -0
  243. data/vendor/javascripts/emscripted-ruby/lib/rss/xmlscanner.rb +121 -0
  244. data/vendor/javascripts/emscripted-ruby/lib/rubyunit.rb +6 -0
  245. data/vendor/javascripts/emscripted-ruby/lib/runit/assert.rb +73 -0
  246. data/vendor/javascripts/emscripted-ruby/lib/runit/cui/testrunner.rb +51 -0
  247. data/vendor/javascripts/emscripted-ruby/lib/runit/error.rb +9 -0
  248. data/vendor/javascripts/emscripted-ruby/lib/runit/testcase.rb +45 -0
  249. data/vendor/javascripts/emscripted-ruby/lib/runit/testresult.rb +44 -0
  250. data/vendor/javascripts/emscripted-ruby/lib/runit/testsuite.rb +26 -0
  251. data/vendor/javascripts/emscripted-ruby/lib/runit/topublic.rb +8 -0
  252. data/vendor/javascripts/emscripted-ruby/lib/scanf.rb +702 -0
  253. data/vendor/javascripts/emscripted-ruby/lib/securerandom.rb +137 -0
  254. data/vendor/javascripts/emscripted-ruby/lib/set.rb +1233 -0
  255. data/vendor/javascripts/emscripted-ruby/lib/shell.rb +269 -0
  256. data/vendor/javascripts/emscripted-ruby/lib/shell/builtin-command.rb +154 -0
  257. data/vendor/javascripts/emscripted-ruby/lib/shell/command-processor.rb +592 -0
  258. data/vendor/javascripts/emscripted-ruby/lib/shell/error.rb +26 -0
  259. data/vendor/javascripts/emscripted-ruby/lib/shell/filter.rb +110 -0
  260. data/vendor/javascripts/emscripted-ruby/lib/shell/process-controller.rb +260 -0
  261. data/vendor/javascripts/emscripted-ruby/lib/shell/system-command.rb +168 -0
  262. data/vendor/javascripts/emscripted-ruby/lib/shell/version.rb +16 -0
  263. data/vendor/javascripts/emscripted-ruby/lib/shellwords.rb +172 -0
  264. data/vendor/javascripts/emscripted-ruby/lib/singleton.rb +360 -0
  265. data/vendor/javascripts/emscripted-ruby/lib/soap/attachment.rb +107 -0
  266. data/vendor/javascripts/emscripted-ruby/lib/soap/baseData.rb +942 -0
  267. data/vendor/javascripts/emscripted-ruby/lib/soap/element.rb +258 -0
  268. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/aspDotNetHandler.rb +213 -0
  269. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/handler.rb +100 -0
  270. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/literalHandler.rb +226 -0
  271. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/soapHandler.rb +582 -0
  272. data/vendor/javascripts/emscripted-ruby/lib/soap/generator.rb +268 -0
  273. data/vendor/javascripts/emscripted-ruby/lib/soap/header/handler.rb +57 -0
  274. data/vendor/javascripts/emscripted-ruby/lib/soap/header/handlerset.rb +70 -0
  275. data/vendor/javascripts/emscripted-ruby/lib/soap/header/simplehandler.rb +44 -0
  276. data/vendor/javascripts/emscripted-ruby/lib/soap/httpconfigloader.rb +119 -0
  277. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping.rb +10 -0
  278. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/factory.rb +355 -0
  279. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/mapping.rb +381 -0
  280. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/registry.rb +541 -0
  281. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/rubytypeFactory.rb +475 -0
  282. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/typeMap.rb +50 -0
  283. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlencodedregistry.rb +280 -0
  284. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlliteralregistry.rb +418 -0
  285. data/vendor/javascripts/emscripted-ruby/lib/soap/marshal.rb +59 -0
  286. data/vendor/javascripts/emscripted-ruby/lib/soap/mimemessage.rb +240 -0
  287. data/vendor/javascripts/emscripted-ruby/lib/soap/netHttpClient.rb +190 -0
  288. data/vendor/javascripts/emscripted-ruby/lib/soap/parser.rb +251 -0
  289. data/vendor/javascripts/emscripted-ruby/lib/soap/processor.rb +66 -0
  290. data/vendor/javascripts/emscripted-ruby/lib/soap/property.rb +333 -0
  291. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/cgistub.rb +206 -0
  292. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/driver.rb +254 -0
  293. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/element.rb +325 -0
  294. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/httpserver.rb +129 -0
  295. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/proxy.rb +497 -0
  296. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/router.rb +594 -0
  297. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/rpc.rb +25 -0
  298. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/soaplet.rb +162 -0
  299. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/standaloneServer.rb +43 -0
  300. data/vendor/javascripts/emscripted-ruby/lib/soap/soap.rb +140 -0
  301. data/vendor/javascripts/emscripted-ruby/lib/soap/streamHandler.rb +229 -0
  302. data/vendor/javascripts/emscripted-ruby/lib/soap/wsdlDriver.rb +575 -0
  303. data/vendor/javascripts/emscripted-ruby/lib/sync.rb +311 -0
  304. data/vendor/javascripts/emscripted-ruby/lib/tempfile.rb +209 -0
  305. data/vendor/javascripts/emscripted-ruby/lib/test/unit.rb +280 -0
  306. data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertionfailederror.rb +14 -0
  307. data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertions.rb +622 -0
  308. data/vendor/javascripts/emscripted-ruby/lib/test/unit/autorunner.rb +220 -0
  309. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector.rb +43 -0
  310. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/dir.rb +107 -0
  311. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/objectspace.rb +34 -0
  312. data/vendor/javascripts/emscripted-ruby/lib/test/unit/error.rb +56 -0
  313. data/vendor/javascripts/emscripted-ruby/lib/test/unit/failure.rb +51 -0
  314. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testcase.rb +160 -0
  315. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testresult.rb +80 -0
  316. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testsuite.rb +76 -0
  317. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/console/testrunner.rb +127 -0
  318. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/fox/testrunner.rb +268 -0
  319. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk/testrunner.rb +416 -0
  320. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk2/testrunner.rb +465 -0
  321. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnermediator.rb +68 -0
  322. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnerutilities.rb +46 -0
  323. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/tk/testrunner.rb +260 -0
  324. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/backtracefilter.rb +40 -0
  325. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/observable.rb +90 -0
  326. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/procwrapper.rb +48 -0
  327. data/vendor/javascripts/emscripted-ruby/lib/thread.rb +479 -0
  328. data/vendor/javascripts/emscripted-ruby/lib/thwait.rb +169 -0
  329. data/vendor/javascripts/emscripted-ruby/lib/time.rb +797 -0
  330. data/vendor/javascripts/emscripted-ruby/lib/timeout.rb +122 -0
  331. data/vendor/javascripts/emscripted-ruby/lib/tmpdir.rb +130 -0
  332. data/vendor/javascripts/emscripted-ruby/lib/tracer.rb +167 -0
  333. data/vendor/javascripts/emscripted-ruby/lib/tsort.rb +290 -0
  334. data/vendor/javascripts/emscripted-ruby/lib/un.rb +235 -0
  335. data/vendor/javascripts/emscripted-ruby/lib/uri.rb +29 -0
  336. data/vendor/javascripts/emscripted-ruby/lib/uri/common.rb +611 -0
  337. data/vendor/javascripts/emscripted-ruby/lib/uri/ftp.rb +198 -0
  338. data/vendor/javascripts/emscripted-ruby/lib/uri/generic.rb +1122 -0
  339. data/vendor/javascripts/emscripted-ruby/lib/uri/http.rb +100 -0
  340. data/vendor/javascripts/emscripted-ruby/lib/uri/https.rb +20 -0
  341. data/vendor/javascripts/emscripted-ruby/lib/uri/ldap.rb +190 -0
  342. data/vendor/javascripts/emscripted-ruby/lib/uri/ldaps.rb +12 -0
  343. data/vendor/javascripts/emscripted-ruby/lib/uri/mailto.rb +266 -0
  344. data/vendor/javascripts/emscripted-ruby/lib/weakref.rb +100 -0
  345. data/vendor/javascripts/emscripted-ruby/lib/webrick.rb +29 -0
  346. data/vendor/javascripts/emscripted-ruby/lib/webrick/accesslog.rb +67 -0
  347. data/vendor/javascripts/emscripted-ruby/lib/webrick/cgi.rb +257 -0
  348. data/vendor/javascripts/emscripted-ruby/lib/webrick/compat.rb +15 -0
  349. data/vendor/javascripts/emscripted-ruby/lib/webrick/config.rb +97 -0
  350. data/vendor/javascripts/emscripted-ruby/lib/webrick/cookie.rb +110 -0
  351. data/vendor/javascripts/emscripted-ruby/lib/webrick/htmlutils.rb +25 -0
  352. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth.rb +45 -0
  353. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/authenticator.rb +79 -0
  354. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/basicauth.rb +65 -0
  355. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/digestauth.rb +343 -0
  356. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htdigest.rb +91 -0
  357. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htgroup.rb +61 -0
  358. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
  359. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/userdb.rb +29 -0
  360. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpproxy.rb +254 -0
  361. data/vendor/javascripts/emscripted-ruby/lib/webrick/httprequest.rb +365 -0
  362. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpresponse.rb +327 -0
  363. data/vendor/javascripts/emscripted-ruby/lib/webrick/https.rb +63 -0
  364. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpserver.rb +210 -0
  365. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet.rb +22 -0
  366. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/abstract.rb +71 -0
  367. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  368. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgihandler.rb +108 -0
  369. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
  370. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
  371. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
  372. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpstatus.rb +126 -0
  373. data/vendor/javascripts/emscripted-ruby/lib/webrick/httputils.rb +399 -0
  374. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpversion.rb +49 -0
  375. data/vendor/javascripts/emscripted-ruby/lib/webrick/log.rb +88 -0
  376. data/vendor/javascripts/emscripted-ruby/lib/webrick/server.rb +200 -0
  377. data/vendor/javascripts/emscripted-ruby/lib/webrick/ssl.rb +126 -0
  378. data/vendor/javascripts/emscripted-ruby/lib/webrick/utils.rb +100 -0
  379. data/vendor/javascripts/emscripted-ruby/lib/webrick/version.rb +13 -0
  380. data/vendor/javascripts/emscripted-ruby/lib/wsdl/binding.rb +65 -0
  381. data/vendor/javascripts/emscripted-ruby/lib/wsdl/data.rb +64 -0
  382. data/vendor/javascripts/emscripted-ruby/lib/wsdl/definitions.rb +250 -0
  383. data/vendor/javascripts/emscripted-ruby/lib/wsdl/documentation.rb +32 -0
  384. data/vendor/javascripts/emscripted-ruby/lib/wsdl/import.rb +80 -0
  385. data/vendor/javascripts/emscripted-ruby/lib/wsdl/importer.rb +38 -0
  386. data/vendor/javascripts/emscripted-ruby/lib/wsdl/info.rb +39 -0
  387. data/vendor/javascripts/emscripted-ruby/lib/wsdl/message.rb +54 -0
  388. data/vendor/javascripts/emscripted-ruby/lib/wsdl/operation.rb +130 -0
  389. data/vendor/javascripts/emscripted-ruby/lib/wsdl/operationBinding.rb +108 -0
  390. data/vendor/javascripts/emscripted-ruby/lib/wsdl/param.rb +85 -0
  391. data/vendor/javascripts/emscripted-ruby/lib/wsdl/parser.rb +163 -0
  392. data/vendor/javascripts/emscripted-ruby/lib/wsdl/part.rb +52 -0
  393. data/vendor/javascripts/emscripted-ruby/lib/wsdl/port.rb +84 -0
  394. data/vendor/javascripts/emscripted-ruby/lib/wsdl/portType.rb +73 -0
  395. data/vendor/javascripts/emscripted-ruby/lib/wsdl/service.rb +61 -0
  396. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/address.rb +40 -0
  397. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/binding.rb +49 -0
  398. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/body.rb +56 -0
  399. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/cgiStubCreator.rb +76 -0
  400. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreator.rb +314 -0
  401. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreatorSupport.rb +126 -0
  402. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/clientSkeltonCreator.rb +78 -0
  403. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/complexType.rb +161 -0
  404. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/data.rb +42 -0
  405. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/definitions.rb +149 -0
  406. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/driverCreator.rb +95 -0
  407. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/element.rb +28 -0
  408. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/fault.rb +56 -0
  409. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/header.rb +86 -0
  410. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/headerfault.rb +56 -0
  411. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/mappingRegistryCreator.rb +92 -0
  412. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/methodDefCreator.rb +228 -0
  413. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/operation.rb +122 -0
  414. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/servantSkeltonCreator.rb +67 -0
  415. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/standaloneServerStubCreator.rb +85 -0
  416. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/wsdl2ruby.rb +176 -0
  417. data/vendor/javascripts/emscripted-ruby/lib/wsdl/types.rb +43 -0
  418. data/vendor/javascripts/emscripted-ruby/lib/wsdl/wsdl.rb +23 -0
  419. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/all.rb +69 -0
  420. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/annotation.rb +34 -0
  421. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/any.rb +56 -0
  422. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/attribute.rb +127 -0
  423. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/choice.rb +69 -0
  424. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexContent.rb +92 -0
  425. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexType.rb +139 -0
  426. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/content.rb +96 -0
  427. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/data.rb +80 -0
  428. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/element.rb +154 -0
  429. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/enumeration.rb +36 -0
  430. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/import.rb +65 -0
  431. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/importer.rb +87 -0
  432. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/include.rb +54 -0
  433. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/length.rb +35 -0
  434. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/parser.rb +166 -0
  435. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/pattern.rb +36 -0
  436. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/schema.rb +143 -0
  437. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/sequence.rb +69 -0
  438. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleContent.rb +65 -0
  439. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleExtension.rb +54 -0
  440. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleRestriction.rb +73 -0
  441. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleType.rb +73 -0
  442. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/unique.rb +34 -0
  443. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/xsd2ruby.rb +107 -0
  444. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/.document +1 -0
  445. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/README.txt +31 -0
  446. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/base64.rb +81 -0
  447. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/client.rb +624 -0
  448. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/config.rb +40 -0
  449. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/create.rb +290 -0
  450. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/datetime.rb +142 -0
  451. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/httpserver.rb +178 -0
  452. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/marshal.rb +76 -0
  453. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/parser.rb +813 -0
  454. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/server.rb +780 -0
  455. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/utils.rb +165 -0
  456. data/vendor/javascripts/emscripted-ruby/lib/xsd/charset.rb +187 -0
  457. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen.rb +12 -0
  458. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/classdef.rb +203 -0
  459. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/commentdef.rb +34 -0
  460. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/gensupport.rb +166 -0
  461. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/methoddef.rb +63 -0
  462. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/moduledef.rb +191 -0
  463. data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes.rb +1269 -0
  464. data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes1999.rb +20 -0
  465. data/vendor/javascripts/emscripted-ruby/lib/xsd/iconvcharset.rb +33 -0
  466. data/vendor/javascripts/emscripted-ruby/lib/xsd/mapping.rb +42 -0
  467. data/vendor/javascripts/emscripted-ruby/lib/xsd/namedelements.rb +95 -0
  468. data/vendor/javascripts/emscripted-ruby/lib/xsd/ns.rb +140 -0
  469. data/vendor/javascripts/emscripted-ruby/lib/xsd/qname.rb +78 -0
  470. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser.rb +61 -0
  471. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/parser.rb +96 -0
  472. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/rexmlparser.rb +54 -0
  473. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlparser.rb +50 -0
  474. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlscanner.rb +147 -0
  475. data/vendor/javascripts/emscripted-ruby/lib/yaml.rb +440 -0
  476. data/vendor/javascripts/emscripted-ruby/lib/yaml/baseemitter.rb +247 -0
  477. data/vendor/javascripts/emscripted-ruby/lib/yaml/basenode.rb +216 -0
  478. data/vendor/javascripts/emscripted-ruby/lib/yaml/constants.rb +45 -0
  479. data/vendor/javascripts/emscripted-ruby/lib/yaml/dbm.rb +111 -0
  480. data/vendor/javascripts/emscripted-ruby/lib/yaml/encoding.rb +33 -0
  481. data/vendor/javascripts/emscripted-ruby/lib/yaml/error.rb +34 -0
  482. data/vendor/javascripts/emscripted-ruby/lib/yaml/loader.rb +14 -0
  483. data/vendor/javascripts/emscripted-ruby/lib/yaml/rubytypes.rb +408 -0
  484. data/vendor/javascripts/emscripted-ruby/lib/yaml/store.rb +43 -0
  485. data/vendor/javascripts/emscripted-ruby/lib/yaml/stream.rb +40 -0
  486. data/vendor/javascripts/emscripted-ruby/lib/yaml/stringio.rb +83 -0
  487. data/vendor/javascripts/emscripted-ruby/lib/yaml/syck.rb +19 -0
  488. data/vendor/javascripts/emscripted-ruby/lib/yaml/tag.rb +91 -0
  489. data/vendor/javascripts/emscripted-ruby/lib/yaml/types.rb +192 -0
  490. data/vendor/javascripts/emscripted-ruby/lib/yaml/yamlnode.rb +54 -0
  491. data/vendor/javascripts/emscripted-ruby/lib/yaml/ypath.rb +52 -0
  492. data/vendor/javascripts/emscripted-ruby/ruby.closure.js +7201 -0
  493. metadata +554 -0
@@ -0,0 +1,91 @@
1
+ require 'drb/drb'
2
+ require 'monitor'
3
+
4
+ module DRb
5
+ class TimerIdConv < DRbIdConv
6
+ class TimerHolder2
7
+ include MonitorMixin
8
+
9
+ class InvalidIndexError < RuntimeError; end
10
+
11
+ def initialize(timeout=600)
12
+ super()
13
+ @sentinel = Object.new
14
+ @gc = {}
15
+ @curr = {}
16
+ @renew = {}
17
+ @timeout = timeout
18
+ @keeper = keeper
19
+ end
20
+
21
+ def add(obj)
22
+ synchronize do
23
+ key = obj.__id__
24
+ @curr[key] = obj
25
+ return key
26
+ end
27
+ end
28
+
29
+ def fetch(key, dv=@sentinel)
30
+ synchronize do
31
+ obj = peek(key)
32
+ if obj == @sentinel
33
+ return dv unless dv == @sentinel
34
+ raise InvalidIndexError
35
+ end
36
+ @renew[key] = obj # KeepIt
37
+ return obj
38
+ end
39
+ end
40
+
41
+ def include?(key)
42
+ synchronize do
43
+ obj = peek(key)
44
+ return false if obj == @sentinel
45
+ true
46
+ end
47
+ end
48
+
49
+ def peek(key)
50
+ synchronize do
51
+ return @curr.fetch(key, @renew.fetch(key, @gc.fetch(key, @sentinel)))
52
+ end
53
+ end
54
+
55
+ private
56
+ def alternate
57
+ synchronize do
58
+ @gc = @curr # GCed
59
+ @curr = @renew
60
+ @renew = {}
61
+ end
62
+ end
63
+
64
+ def keeper
65
+ Thread.new do
66
+ loop do
67
+ size = alternate
68
+ sleep(@timeout)
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ def initialize(timeout=600)
75
+ @holder = TimerHolder2.new(timeout)
76
+ end
77
+
78
+ def to_obj(ref)
79
+ return super if ref.nil?
80
+ @holder.fetch(ref)
81
+ rescue TimerHolder2::InvalidIndexError
82
+ raise "invalid reference"
83
+ end
84
+
85
+ def to_id(obj)
86
+ return @holder.add(obj)
87
+ end
88
+ end
89
+ end
90
+
91
+ # DRb.install_id_conv(TimerIdConv.new)
@@ -0,0 +1,108 @@
1
+ require 'socket'
2
+ require 'drb/drb'
3
+ require 'tmpdir'
4
+
5
+ raise(LoadError, "UNIXServer is required") unless defined?(UNIXServer)
6
+
7
+ module DRb
8
+
9
+ class DRbUNIXSocket < DRbTCPSocket
10
+ def self.parse_uri(uri)
11
+ if /^drbunix:(.*?)(\?(.*))?$/ =~ uri
12
+ filename = $1
13
+ option = $3
14
+ [filename, option]
15
+ else
16
+ raise(DRbBadScheme, uri) unless uri =~ /^drbunix:/
17
+ raise(DRbBadURI, 'can\'t parse uri:' + uri)
18
+ end
19
+ end
20
+
21
+ def self.open(uri, config)
22
+ filename, option = parse_uri(uri)
23
+ filename.untaint
24
+ soc = UNIXSocket.open(filename)
25
+ self.new(uri, soc, config)
26
+ end
27
+
28
+ def self.open_server(uri, config)
29
+ filename, option = parse_uri(uri)
30
+ if filename.size == 0
31
+ soc = temp_server
32
+ filename = soc.path
33
+ uri = 'drbunix:' + soc.path
34
+ else
35
+ soc = UNIXServer.open(filename)
36
+ end
37
+ owner = config[:UNIXFileOwner]
38
+ group = config[:UNIXFileGroup]
39
+ if owner || group
40
+ require 'etc'
41
+ owner = Etc.getpwnam( owner ).uid if owner
42
+ group = Etc.getgrnam( group ).gid if group
43
+ File.chown owner, group, filename
44
+ end
45
+ mode = config[:UNIXFileMode]
46
+ File.chmod(mode, filename) if mode
47
+
48
+ self.new(uri, soc, config, true)
49
+ end
50
+
51
+ def self.uri_option(uri, config)
52
+ filename, option = parse_uri(uri)
53
+ return "drbunix:#{filename}", option
54
+ end
55
+
56
+ def initialize(uri, soc, config={}, server_mode = false)
57
+ super(uri, soc, config)
58
+ set_sockopt(@socket)
59
+ @server_mode = server_mode
60
+ @acl = nil
61
+ end
62
+
63
+ # import from tempfile.rb
64
+ Max_try = 10
65
+ private
66
+ def self.temp_server
67
+ tmpdir = Dir::tmpdir
68
+ n = 0
69
+ while true
70
+ begin
71
+ tmpname = sprintf('%s/druby%d.%d', tmpdir, $$, n)
72
+ lock = tmpname + '.lock'
73
+ unless File.exist?(tmpname) or File.exist?(lock)
74
+ Dir.mkdir(lock)
75
+ break
76
+ end
77
+ rescue
78
+ raise "cannot generate tempfile `%s'" % tmpname if n >= Max_try
79
+ #sleep(1)
80
+ end
81
+ n += 1
82
+ end
83
+ soc = UNIXServer.new(tmpname)
84
+ Dir.rmdir(lock)
85
+ soc
86
+ end
87
+
88
+ public
89
+ def close
90
+ return unless @socket
91
+ path = @socket.path if @server_mode
92
+ @socket.close
93
+ File.unlink(path) if @server_mode
94
+ @socket = nil
95
+ end
96
+
97
+ def accept
98
+ s = @socket.accept
99
+ self.class.new(nil, s, @config)
100
+ end
101
+
102
+ def set_sockopt(soc)
103
+ soc.fcntl(Fcntl::F_SETFL, Fcntl::FD_CLOEXEC) if defined? Fcntl::FD_CLOEXEC
104
+ end
105
+ end
106
+
107
+ DRbProtocol.add_protocol(DRbUNIXSocket)
108
+ end
@@ -0,0 +1,195 @@
1
+ #
2
+ # e2mmap.rb - for ruby 1.1
3
+ # $Release Version: 2.0$
4
+ # $Revision: 1.10 $
5
+ # $Date: 1999/02/17 12:33:17 $
6
+ # by Keiju ISHITSUKA
7
+ #
8
+ # --
9
+ # Usage:
10
+ #
11
+ # U1)
12
+ # class Foo
13
+ # extend Exception2MessageMapper
14
+ # def_e2message ExistingExceptionClass, "message..."
15
+ # def_exception :NewExceptionClass, "message..."[, superclass]
16
+ # ...
17
+ # end
18
+ #
19
+ # U2)
20
+ # module Error
21
+ # extend Exception2MessageMapper
22
+ # def_e2meggage ExistingExceptionClass, "message..."
23
+ # def_exception :NewExceptionClass, "message..."[, superclass]
24
+ # ...
25
+ # end
26
+ # class Foo
27
+ # include Error
28
+ # ...
29
+ # end
30
+ #
31
+ # foo = Foo.new
32
+ # foo.Fail ....
33
+ #
34
+ # U3)
35
+ # module Error
36
+ # extend Exception2MessageMapper
37
+ # def_e2message ExistingExceptionClass, "message..."
38
+ # def_exception :NewExceptionClass, "message..."[, superclass]
39
+ # ...
40
+ # end
41
+ # class Foo
42
+ # extend Exception2MessageMapper
43
+ # include Error
44
+ # ...
45
+ # end
46
+ #
47
+ # Foo.Fail NewExceptionClass, arg...
48
+ # Foo.Fail ExistingExceptionClass, arg...
49
+ #
50
+ #
51
+ fail "Use Ruby 1.1" if VERSION < "1.1"
52
+
53
+ module Exception2MessageMapper
54
+ @RCS_ID='-$Id: e2mmap.rb,v 1.10 1999/02/17 12:33:17 keiju Exp keiju $-'
55
+
56
+ E2MM = Exception2MessageMapper
57
+
58
+ def E2MM.extend_object(cl)
59
+ super
60
+ cl.bind(self) unless cl == E2MM
61
+ end
62
+
63
+ # backward compatibility
64
+ def E2MM.extend_to(b)
65
+ c = eval("self", b)
66
+ c.extend(self)
67
+ end
68
+
69
+ def bind(cl)
70
+ self.module_eval %[
71
+ def Raise(err = nil, *rest)
72
+ Exception2MessageMapper.Raise(self.class, err, *rest)
73
+ end
74
+ alias Fail Raise
75
+
76
+ def self.included(mod)
77
+ mod.extend Exception2MessageMapper
78
+ end
79
+ ]
80
+ end
81
+
82
+ # Fail(err, *rest)
83
+ # err: exception
84
+ # rest: message arguments
85
+ #
86
+ def Raise(err = nil, *rest)
87
+ E2MM.Raise(self, err, *rest)
88
+ end
89
+ alias Fail Raise
90
+
91
+ # backward compatibility
92
+ alias fail! fail
93
+ def fail(err = nil, *rest)
94
+ begin
95
+ E2MM.Fail(self, err, *rest)
96
+ rescue E2MM::ErrNotRegisteredException
97
+ super
98
+ end
99
+ end
100
+ class << self
101
+ public :fail
102
+ end
103
+
104
+
105
+ # def_e2message(c, m)
106
+ # c: exception
107
+ # m: message_form
108
+ # define exception c with message m.
109
+ #
110
+ def def_e2message(c, m)
111
+ E2MM.def_e2message(self, c, m)
112
+ end
113
+
114
+ # def_exception(n, m, s)
115
+ # n: exception_name
116
+ # m: message_form
117
+ # s: superclass(default: StandardError)
118
+ # define exception named ``c'' with message m.
119
+ #
120
+ def def_exception(n, m, s = StandardError)
121
+ E2MM.def_exception(self, n, m, s)
122
+ end
123
+
124
+ #
125
+ # Private definitions.
126
+ #
127
+ # {[class, exp] => message, ...}
128
+ @MessageMap = {}
129
+
130
+ # E2MM.def_exception(k, e, m)
131
+ # k: class to define exception under.
132
+ # e: exception
133
+ # m: message_form
134
+ # define exception c with message m.
135
+ #
136
+ def E2MM.def_e2message(k, c, m)
137
+ E2MM.instance_eval{@MessageMap[[k, c]] = m}
138
+ c
139
+ end
140
+
141
+ # E2MM.def_exception(k, n, m, s)
142
+ # k: class to define exception under.
143
+ # n: exception_name
144
+ # m: message_form
145
+ # s: superclass(default: StandardError)
146
+ # define exception named ``c'' with message m.
147
+ #
148
+ def E2MM.def_exception(k, n, m, s = StandardError)
149
+ n = n.id2name if n.kind_of?(Fixnum)
150
+ e = Class.new(s)
151
+ E2MM.instance_eval{@MessageMap[[k, e]] = m}
152
+ k.const_set(n, e)
153
+ end
154
+
155
+ # Fail(klass, err, *rest)
156
+ # klass: class to define exception under.
157
+ # err: exception
158
+ # rest: message arguments
159
+ #
160
+ def E2MM.Raise(klass = E2MM, err = nil, *rest)
161
+ if form = e2mm_message(klass, err)
162
+ $! = err.new(sprintf(form, *rest))
163
+ $@ = caller(1) if $@.nil?
164
+ #p $@
165
+ #p __FILE__
166
+ $@.shift if $@[0] =~ /^#{Regexp.quote(__FILE__)}:/
167
+ raise
168
+ else
169
+ E2MM.Fail E2MM, ErrNotRegisteredException, err.inspect
170
+ end
171
+ end
172
+ class <<E2MM
173
+ alias Fail Raise
174
+ end
175
+
176
+ def E2MM.e2mm_message(klass, exp)
177
+ for c in klass.ancestors
178
+ if mes = @MessageMap[[c,exp]]
179
+ #p mes
180
+ m = klass.instance_eval('"' + mes + '"')
181
+ return m
182
+ end
183
+ end
184
+ nil
185
+ end
186
+ class <<self
187
+ alias message e2mm_message
188
+ end
189
+
190
+ E2MM.def_exception(E2MM,
191
+ :ErrNotRegisteredException,
192
+ "not registerd exception(%s)")
193
+ end
194
+
195
+
@@ -0,0 +1,880 @@
1
+ # = ERB -- Ruby Templating
2
+ #
3
+ # Author:: Masatoshi SEKI
4
+ # Documentation:: James Edward Gray II and Gavin Sinclair
5
+ #
6
+ # See ERB for primary documentation and ERB::Util for a couple of utility
7
+ # routines.
8
+ #
9
+ # Copyright (c) 1999-2000,2002,2003 Masatoshi SEKI
10
+ #
11
+ # You can redistribute it and/or modify it under the same terms as Ruby.
12
+
13
+ #
14
+ # = ERB -- Ruby Templating
15
+ #
16
+ # == Introduction
17
+ #
18
+ # ERB provides an easy to use but powerful templating system for Ruby. Using
19
+ # ERB, actual Ruby code can be added to any plain text document for the
20
+ # purposes of generating document information details and/or flow control.
21
+ #
22
+ # A very simple example is this:
23
+ #
24
+ # require 'erb'
25
+ #
26
+ # x = 42
27
+ # template = ERB.new <<-EOF
28
+ # The value of x is: <%= x %>
29
+ # EOF
30
+ # puts template.result(binding)
31
+ #
32
+ # <em>Prints:</em> The value of x is: 42
33
+ #
34
+ # More complex examples are given below.
35
+ #
36
+ #
37
+ # == Recognized Tags
38
+ #
39
+ # ERB recognizes certain tags in the provided template and converts them based
40
+ # on the rules below:
41
+ #
42
+ # <% Ruby code -- inline with output %>
43
+ # <%= Ruby expression -- replace with result %>
44
+ # <%# comment -- ignored -- useful in testing %>
45
+ # % a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
46
+ # %% replaced with % if first thing on a line and % processing is used
47
+ # <%% or %%> -- replace with <% or %> respectively
48
+ #
49
+ # All other text is passed through ERB filtering unchanged.
50
+ #
51
+ #
52
+ # == Options
53
+ #
54
+ # There are several settings you can change when you use ERB:
55
+ # * the nature of the tags that are recognized;
56
+ # * the value of <tt>$SAFE</tt> under which the template is run;
57
+ # * the binding used to resolve local variables in the template.
58
+ #
59
+ # See the ERB.new and ERB#result methods for more detail.
60
+ #
61
+ #
62
+ # == Examples
63
+ #
64
+ # === Plain Text
65
+ #
66
+ # ERB is useful for any generic templating situation. Note that in this example, we use the
67
+ # convenient "% at start of line" tag, and we quote the template literally with
68
+ # <tt>%q{...}</tt> to avoid trouble with the backslash.
69
+ #
70
+ # require "erb"
71
+ #
72
+ # # Create template.
73
+ # template = %q{
74
+ # From: James Edward Gray II <james@grayproductions.net>
75
+ # To: <%= to %>
76
+ # Subject: Addressing Needs
77
+ #
78
+ # <%= to[/\w+/] %>:
79
+ #
80
+ # Just wanted to send a quick note assuring that your needs are being
81
+ # addressed.
82
+ #
83
+ # I want you to know that my team will keep working on the issues,
84
+ # especially:
85
+ #
86
+ # <%# ignore numerous minor requests -- focus on priorities %>
87
+ # % priorities.each do |priority|
88
+ # * <%= priority %>
89
+ # % end
90
+ #
91
+ # Thanks for your patience.
92
+ #
93
+ # James Edward Gray II
94
+ # }.gsub(/^ /, '')
95
+ #
96
+ # message = ERB.new(template, 0, "%<>")
97
+ #
98
+ # # Set up template data.
99
+ # to = "Community Spokesman <spokesman@ruby_community.org>"
100
+ # priorities = [ "Run Ruby Quiz",
101
+ # "Document Modules",
102
+ # "Answer Questions on Ruby Talk" ]
103
+ #
104
+ # # Produce result.
105
+ # email = message.result
106
+ # puts email
107
+ #
108
+ # <i>Generates:</i>
109
+ #
110
+ # From: James Edward Gray II <james@grayproductions.net>
111
+ # To: Community Spokesman <spokesman@ruby_community.org>
112
+ # Subject: Addressing Needs
113
+ #
114
+ # Community:
115
+ #
116
+ # Just wanted to send a quick note assuring that your needs are being addressed.
117
+ #
118
+ # I want you to know that my team will keep working on the issues, especially:
119
+ #
120
+ # * Run Ruby Quiz
121
+ # * Document Modules
122
+ # * Answer Questions on Ruby Talk
123
+ #
124
+ # Thanks for your patience.
125
+ #
126
+ # James Edward Gray II
127
+ #
128
+ # === Ruby in HTML
129
+ #
130
+ # ERB is often used in <tt>.rhtml</tt> files (HTML with embedded Ruby). Notice the need in
131
+ # this example to provide a special binding when the template is run, so that the instance
132
+ # variables in the Product object can be resolved.
133
+ #
134
+ # require "erb"
135
+ #
136
+ # # Build template data class.
137
+ # class Product
138
+ # def initialize( code, name, desc, cost )
139
+ # @code = code
140
+ # @name = name
141
+ # @desc = desc
142
+ # @cost = cost
143
+ #
144
+ # @features = [ ]
145
+ # end
146
+ #
147
+ # def add_feature( feature )
148
+ # @features << feature
149
+ # end
150
+ #
151
+ # # Support templating of member data.
152
+ # def get_binding
153
+ # binding
154
+ # end
155
+ #
156
+ # # ...
157
+ # end
158
+ #
159
+ # # Create template.
160
+ # template = %{
161
+ # <html>
162
+ # <head><title>Ruby Toys -- <%= @name %></title></head>
163
+ # <body>
164
+ #
165
+ # <h1><%= @name %> (<%= @code %>)</h1>
166
+ # <p><%= @desc %></p>
167
+ #
168
+ # <ul>
169
+ # <% @features.each do |f| %>
170
+ # <li><b><%= f %></b></li>
171
+ # <% end %>
172
+ # </ul>
173
+ #
174
+ # <p>
175
+ # <% if @cost < 10 %>
176
+ # <b>Only <%= @cost %>!!!</b>
177
+ # <% else %>
178
+ # Call for a price, today!
179
+ # <% end %>
180
+ # </p>
181
+ #
182
+ # </body>
183
+ # </html>
184
+ # }.gsub(/^ /, '')
185
+ #
186
+ # rhtml = ERB.new(template)
187
+ #
188
+ # # Set up template data.
189
+ # toy = Product.new( "TZ-1002",
190
+ # "Rubysapien",
191
+ # "Geek's Best Friend! Responds to Ruby commands...",
192
+ # 999.95 )
193
+ # toy.add_feature("Listens for verbal commands in the Ruby language!")
194
+ # toy.add_feature("Ignores Perl, Java, and all C variants.")
195
+ # toy.add_feature("Karate-Chop Action!!!")
196
+ # toy.add_feature("Matz signature on left leg.")
197
+ # toy.add_feature("Gem studded eyes... Rubies, of course!")
198
+ #
199
+ # # Produce result.
200
+ # rhtml.run(toy.get_binding)
201
+ #
202
+ # <i>Generates (some blank lines removed):</i>
203
+ #
204
+ # <html>
205
+ # <head><title>Ruby Toys -- Rubysapien</title></head>
206
+ # <body>
207
+ #
208
+ # <h1>Rubysapien (TZ-1002)</h1>
209
+ # <p>Geek's Best Friend! Responds to Ruby commands...</p>
210
+ #
211
+ # <ul>
212
+ # <li><b>Listens for verbal commands in the Ruby language!</b></li>
213
+ # <li><b>Ignores Perl, Java, and all C variants.</b></li>
214
+ # <li><b>Karate-Chop Action!!!</b></li>
215
+ # <li><b>Matz signature on left leg.</b></li>
216
+ # <li><b>Gem studded eyes... Rubies, of course!</b></li>
217
+ # </ul>
218
+ #
219
+ # <p>
220
+ # Call for a price, today!
221
+ # </p>
222
+ #
223
+ # </body>
224
+ # </html>
225
+ #
226
+ #
227
+ # == Notes
228
+ #
229
+ # There are a variety of templating solutions available in various Ruby projects:
230
+ # * ERB's big brother, eRuby, works the same but is written in C for speed;
231
+ # * Amrita (smart at producing HTML/XML);
232
+ # * cs/Template (written in C for speed);
233
+ # * RDoc, distributed with Ruby, uses its own template engine, which can be reused elsewhere;
234
+ # * and others; search the RAA.
235
+ #
236
+ # Rails, the web application framework, uses ERB to create views.
237
+ #
238
+ class ERB
239
+ Revision = '$Date: 2008-03-24 01:27:20 +0900 (Mon, 24 Mar 2008) $' #'
240
+
241
+ # Returns revision information for the erb.rb module.
242
+ def self.version
243
+ "erb.rb [2.1.0 #{ERB::Revision.split[1]}]"
244
+ end
245
+ end
246
+
247
+ #--
248
+ # ERB::Compiler
249
+ class ERB
250
+ class Compiler # :nodoc:
251
+ class PercentLine # :nodoc:
252
+ def initialize(str)
253
+ @value = str
254
+ end
255
+ attr_reader :value
256
+ alias :to_s :value
257
+
258
+ def empty?
259
+ @value.empty?
260
+ end
261
+ end
262
+
263
+ class Scanner # :nodoc:
264
+ @scanner_map = {}
265
+ def self.regist_scanner(klass, trim_mode, percent)
266
+ @scanner_map[[trim_mode, percent]] = klass
267
+ end
268
+
269
+ def self.default_scanner=(klass)
270
+ @default_scanner = klass
271
+ end
272
+
273
+ def self.make_scanner(src, trim_mode, percent)
274
+ klass = @scanner_map.fetch([trim_mode, percent], @default_scanner)
275
+ klass.new(src, trim_mode, percent)
276
+ end
277
+
278
+ def initialize(src, trim_mode, percent)
279
+ @src = src
280
+ @stag = nil
281
+ end
282
+ attr_accessor :stag
283
+
284
+ def scan; end
285
+ end
286
+
287
+ class TrimScanner < Scanner # :nodoc:
288
+ def initialize(src, trim_mode, percent)
289
+ super
290
+ @trim_mode = trim_mode
291
+ @percent = percent
292
+ if @trim_mode == '>'
293
+ @scan_line = self.method(:trim_line1)
294
+ elsif @trim_mode == '<>'
295
+ @scan_line = self.method(:trim_line2)
296
+ elsif @trim_mode == '-'
297
+ @scan_line = self.method(:explicit_trim_line)
298
+ else
299
+ @scan_line = self.method(:scan_line)
300
+ end
301
+ end
302
+ attr_accessor :stag
303
+
304
+ def scan(&block)
305
+ @stag = nil
306
+ if @percent
307
+ @src.each do |line|
308
+ percent_line(line, &block)
309
+ end
310
+ else
311
+ @scan_line.call(@src, &block)
312
+ end
313
+ nil
314
+ end
315
+
316
+ def percent_line(line, &block)
317
+ if @stag || line[0] != ?%
318
+ return @scan_line.call(line, &block)
319
+ end
320
+
321
+ line[0] = ''
322
+ if line[0] == ?%
323
+ @scan_line.call(line, &block)
324
+ else
325
+ yield(PercentLine.new(line.chomp))
326
+ end
327
+ end
328
+
329
+ def scan_line(line)
330
+ line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>|\n|\z)/m) do |token|
331
+ next if token.empty?
332
+ yield(token)
333
+ end
334
+ end
335
+
336
+ def trim_line1(line)
337
+ line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
338
+ tokens.each do |token|
339
+ next if token.empty?
340
+ if token == "%>\n"
341
+ yield('%>')
342
+ yield(:cr)
343
+ else
344
+ yield(token)
345
+ end
346
+ end
347
+ end
348
+ end
349
+
350
+ def trim_line2(line)
351
+ head = nil
352
+ line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
353
+ tokens.each do |token|
354
+ next if token.empty?
355
+ head = token unless head
356
+ if token == "%>\n"
357
+ yield('%>')
358
+ if is_erb_stag?(head)
359
+ yield(:cr)
360
+ else
361
+ yield("\n")
362
+ end
363
+ head = nil
364
+ else
365
+ yield(token)
366
+ head = nil if token == "\n"
367
+ end
368
+ end
369
+ end
370
+ end
371
+
372
+ ExplicitTrimRegexp = /(^[ \t]*<%-)|(-%>\n?\z)|(<%-)|(-%>)|(<%%)|(%%>)|(<%=)|(<%#)|(<%)|(%>)|(\n)/
373
+ def explicit_trim_line(line)
374
+ line.split(ExplicitTrimRegexp).each do |token|
375
+ next if token.empty?
376
+ if @stag.nil? && /[ \t]*<%-/ =~ token
377
+ yield('<%')
378
+ elsif @stag && /-%>\n/ =~ token
379
+ yield('%>')
380
+ yield(:cr)
381
+ elsif @stag && token == '-%>'
382
+ yield('%>')
383
+ else
384
+ yield(token)
385
+ end
386
+ end
387
+ end
388
+
389
+ ERB_STAG = %w(<%= <%# <%)
390
+ def is_erb_stag?(s)
391
+ ERB_STAG.member?(s)
392
+ end
393
+ end
394
+
395
+ Scanner.default_scanner = TrimScanner
396
+
397
+ class SimpleScanner < Scanner # :nodoc:
398
+ def scan
399
+ @src.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>|\n|\z)/m) do |tokens|
400
+ tokens.each do |token|
401
+ next if token.empty?
402
+ yield(token)
403
+ end
404
+ end
405
+ end
406
+ end
407
+
408
+ Scanner.regist_scanner(SimpleScanner, nil, false)
409
+
410
+ begin
411
+ require 'strscan'
412
+ class SimpleScanner2 < Scanner # :nodoc:
413
+ def scan
414
+ stag_reg = /(.*?)(<%%|<%=|<%#|<%|\z)/m
415
+ etag_reg = /(.*?)(%%>|%>|\z)/m
416
+ scanner = StringScanner.new(@src)
417
+ while ! scanner.eos?
418
+ scanner.scan(@stag ? etag_reg : stag_reg)
419
+ yield(scanner[1])
420
+ yield(scanner[2])
421
+ end
422
+ end
423
+ end
424
+ Scanner.regist_scanner(SimpleScanner2, nil, false)
425
+
426
+ class PercentScanner < Scanner # :nodoc:
427
+ def scan
428
+ stag_reg = /(.*?)(^%%|^%|<%%|<%=|<%#|<%|\z)/m
429
+ etag_reg = /(.*?)(%%>|%>|\z)/m
430
+ scanner = StringScanner.new(@src)
431
+ while ! scanner.eos?
432
+ scanner.scan(@stag ? etag_reg : stag_reg)
433
+ yield(scanner[1])
434
+
435
+ elem = scanner[2]
436
+ if elem == '%%'
437
+ elem = '%'
438
+ elsif elem == '%'
439
+ elem = PercentLine.new(scanner.scan(/.*?(\n|\z)/).chomp)
440
+ end
441
+ yield(elem)
442
+ end
443
+ end
444
+ end
445
+ Scanner.regist_scanner(PercentScanner, nil, true)
446
+
447
+ class ExplicitScanner < Scanner # :nodoc:
448
+ def scan
449
+ stag_reg = /(.*?)(^[ \t]*<%-|<%%|<%=|<%#|<%-|<%|\z)/m
450
+ etag_reg = /(.*?)(%%>|-%>|%>|\z)/m
451
+ scanner = StringScanner.new(@src)
452
+ while ! scanner.eos?
453
+ scanner.scan(@stag ? etag_reg : stag_reg)
454
+ yield(scanner[1])
455
+
456
+ elem = scanner[2]
457
+ if /[ \t]*<%-/ =~ elem
458
+ yield('<%')
459
+ elsif elem == '-%>'
460
+ yield('%>')
461
+ yield(:cr) if scanner.scan(/(\n|\z)/)
462
+ else
463
+ yield(elem)
464
+ end
465
+ end
466
+ end
467
+ end
468
+ Scanner.regist_scanner(ExplicitScanner, '-', false)
469
+
470
+ rescue LoadError
471
+ end
472
+
473
+ class Buffer # :nodoc:
474
+ def initialize(compiler)
475
+ @compiler = compiler
476
+ @line = []
477
+ @script = ""
478
+ @compiler.pre_cmd.each do |x|
479
+ push(x)
480
+ end
481
+ end
482
+ attr_reader :script
483
+
484
+ def push(cmd)
485
+ @line << cmd
486
+ end
487
+
488
+ def cr
489
+ @script << (@line.join('; '))
490
+ @line = []
491
+ @script << "\n"
492
+ end
493
+
494
+ def close
495
+ return unless @line
496
+ @compiler.post_cmd.each do |x|
497
+ push(x)
498
+ end
499
+ @script << (@line.join('; '))
500
+ @line = nil
501
+ end
502
+ end
503
+
504
+ def content_dump(s)
505
+ n = s.count("\n")
506
+ if n > 0
507
+ s.dump + "\n" * n
508
+ else
509
+ s.dump
510
+ end
511
+ end
512
+
513
+ def compile(s)
514
+ out = Buffer.new(self)
515
+
516
+ content = ''
517
+ scanner = make_scanner(s)
518
+ scanner.scan do |token|
519
+ next if token.nil?
520
+ next if token == ''
521
+ if scanner.stag.nil?
522
+ case token
523
+ when PercentLine
524
+ out.push("#{@put_cmd} #{content_dump(content)}") if content.size > 0
525
+ content = ''
526
+ out.push(token.to_s)
527
+ out.cr
528
+ when :cr
529
+ out.cr
530
+ when '<%', '<%=', '<%#'
531
+ scanner.stag = token
532
+ out.push("#{@put_cmd} #{content_dump(content)}") if content.size > 0
533
+ content = ''
534
+ when "\n"
535
+ content << "\n"
536
+ out.push("#{@put_cmd} #{content_dump(content)}")
537
+ content = ''
538
+ when '<%%'
539
+ content << '<%'
540
+ else
541
+ content << token
542
+ end
543
+ else
544
+ case token
545
+ when '%>'
546
+ case scanner.stag
547
+ when '<%'
548
+ if content[-1] == ?\n
549
+ content.chop!
550
+ out.push(content)
551
+ out.cr
552
+ else
553
+ out.push(content)
554
+ end
555
+ when '<%='
556
+ out.push("#{@insert_cmd}((#{content}).to_s)")
557
+ when '<%#'
558
+ # out.push("# #{content_dump(content)}")
559
+ end
560
+ scanner.stag = nil
561
+ content = ''
562
+ when '%%>'
563
+ content << '%>'
564
+ else
565
+ content << token
566
+ end
567
+ end
568
+ end
569
+ out.push("#{@put_cmd} #{content_dump(content)}") if content.size > 0
570
+ out.close
571
+ out.script
572
+ end
573
+
574
+ def prepare_trim_mode(mode)
575
+ case mode
576
+ when 1
577
+ return [false, '>']
578
+ when 2
579
+ return [false, '<>']
580
+ when 0
581
+ return [false, nil]
582
+ when String
583
+ perc = mode.include?('%')
584
+ if mode.include?('-')
585
+ return [perc, '-']
586
+ elsif mode.include?('<>')
587
+ return [perc, '<>']
588
+ elsif mode.include?('>')
589
+ return [perc, '>']
590
+ else
591
+ [perc, nil]
592
+ end
593
+ else
594
+ return [false, nil]
595
+ end
596
+ end
597
+
598
+ def make_scanner(src)
599
+ Scanner.make_scanner(src, @trim_mode, @percent)
600
+ end
601
+
602
+ def initialize(trim_mode)
603
+ @percent, @trim_mode = prepare_trim_mode(trim_mode)
604
+ @put_cmd = 'print'
605
+ @insert_cmd = @put_cmd
606
+ @pre_cmd = []
607
+ @post_cmd = []
608
+ end
609
+ attr_reader :percent, :trim_mode
610
+ attr_accessor :put_cmd, :insert_cmd, :pre_cmd, :post_cmd
611
+ end
612
+ end
613
+
614
+ #--
615
+ # ERB
616
+ class ERB
617
+ #
618
+ # Constructs a new ERB object with the template specified in _str_.
619
+ #
620
+ # An ERB object works by building a chunk of Ruby code that will output
621
+ # the completed template when run. If _safe_level_ is set to a non-nil value,
622
+ # ERB code will be run in a separate thread with <b>$SAFE</b> set to the
623
+ # provided level.
624
+ #
625
+ # If _trim_mode_ is passed a String containing one or more of the following
626
+ # modifiers, ERB will adjust its code generation as listed:
627
+ #
628
+ # % enables Ruby code processing for lines beginning with %
629
+ # <> omit newline for lines starting with <% and ending in %>
630
+ # > omit newline for lines ending in %>
631
+ #
632
+ # _eoutvar_ can be used to set the name of the variable ERB will build up
633
+ # its output in. This is useful when you need to run multiple ERB
634
+ # templates through the same binding and/or when you want to control where
635
+ # output ends up. Pass the name of the variable to be used inside a String.
636
+ #
637
+ # === Example
638
+ #
639
+ # require "erb"
640
+ #
641
+ # # build data class
642
+ # class Listings
643
+ # PRODUCT = { :name => "Chicken Fried Steak",
644
+ # :desc => "A well messages pattie, breaded and fried.",
645
+ # :cost => 9.95 }
646
+ #
647
+ # attr_reader :product, :price
648
+ #
649
+ # def initialize( product = "", price = "" )
650
+ # @product = product
651
+ # @price = price
652
+ # end
653
+ #
654
+ # def build
655
+ # b = binding
656
+ # # create and run templates, filling member data variebles
657
+ # ERB.new(<<-'END_PRODUCT'.gsub(/^\s+/, ""), 0, "", "@product").result b
658
+ # <%= PRODUCT[:name] %>
659
+ # <%= PRODUCT[:desc] %>
660
+ # END_PRODUCT
661
+ # ERB.new(<<-'END_PRICE'.gsub(/^\s+/, ""), 0, "", "@price").result b
662
+ # <%= PRODUCT[:name] %> -- <%= PRODUCT[:cost] %>
663
+ # <%= PRODUCT[:desc] %>
664
+ # END_PRICE
665
+ # end
666
+ # end
667
+ #
668
+ # # setup template data
669
+ # listings = Listings.new
670
+ # listings.build
671
+ #
672
+ # puts listings.product + "\n" + listings.price
673
+ #
674
+ # _Generates_
675
+ #
676
+ # Chicken Fried Steak
677
+ # A well messages pattie, breaded and fried.
678
+ #
679
+ # Chicken Fried Steak -- 9.95
680
+ # A well messages pattie, breaded and fried.
681
+ #
682
+ def initialize(str, safe_level=nil, trim_mode=nil, eoutvar='_erbout')
683
+ @safe_level = safe_level
684
+ compiler = ERB::Compiler.new(trim_mode)
685
+ set_eoutvar(compiler, eoutvar)
686
+ @src = compiler.compile(str)
687
+ @filename = nil
688
+ end
689
+
690
+ # The Ruby code generated by ERB
691
+ attr_reader :src
692
+
693
+ # The optional _filename_ argument passed to Kernel#eval when the ERB code
694
+ # is run
695
+ attr_accessor :filename
696
+
697
+ #
698
+ # Can be used to set _eoutvar_ as described in ERB#new. It's probably easier
699
+ # to just use the constructor though, since calling this method requires the
700
+ # setup of an ERB _compiler_ object.
701
+ #
702
+ def set_eoutvar(compiler, eoutvar = '_erbout')
703
+ compiler.put_cmd = "#{eoutvar}.concat"
704
+ compiler.insert_cmd = "#{eoutvar}.concat"
705
+
706
+ cmd = []
707
+ cmd.push "#{eoutvar} = ''"
708
+
709
+ compiler.pre_cmd = cmd
710
+
711
+ cmd = []
712
+ cmd.push(eoutvar)
713
+
714
+ compiler.post_cmd = cmd
715
+ end
716
+
717
+ # Generate results and print them. (see ERB#result)
718
+ def run(b=TOPLEVEL_BINDING)
719
+ print self.result(b)
720
+ end
721
+
722
+ #
723
+ # Executes the generated ERB code to produce a completed template, returning
724
+ # the results of that code. (See ERB#new for details on how this process can
725
+ # be affected by _safe_level_.)
726
+ #
727
+ # _b_ accepts a Binding or Proc object which is used to set the context of
728
+ # code evaluation.
729
+ #
730
+ def result(b=TOPLEVEL_BINDING)
731
+ if @safe_level
732
+ proc {
733
+ $SAFE = @safe_level
734
+ eval(@src, b, (@filename || '(erb)'), 1)
735
+ }.call
736
+ else
737
+ eval(@src, b, (@filename || '(erb)'), 1)
738
+ end
739
+ end
740
+
741
+ # Define _methodname_ as instance method of _mod_ from compiled ruby source.
742
+ #
743
+ # example:
744
+ # filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml
745
+ # erb = ERB.new(File.read(filename))
746
+ # erb.def_method(MyClass, 'render(arg1, arg2)', filename)
747
+ # print MyClass.new.render('foo', 123)
748
+ def def_method(mod, methodname, fname='(ERB)')
749
+ mod.module_eval("def #{methodname}\n" + self.src + "\nend\n", fname, 0)
750
+ end
751
+
752
+ # Create unnamed module, define _methodname_ as instance method of it, and return it.
753
+ #
754
+ # example:
755
+ # filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml
756
+ # erb = ERB.new(File.read(filename))
757
+ # erb.filename = filename
758
+ # MyModule = erb.def_module('render(arg1, arg2)')
759
+ # class MyClass
760
+ # include MyModule
761
+ # end
762
+ def def_module(methodname='erb')
763
+ mod = Module.new
764
+ def_method(mod, methodname, @filename || '(ERB)')
765
+ mod
766
+ end
767
+
768
+ # Define unnamed class which has _methodname_ as instance method, and return it.
769
+ #
770
+ # example:
771
+ # class MyClass_
772
+ # def initialize(arg1, arg2)
773
+ # @arg1 = arg1; @arg2 = arg2
774
+ # end
775
+ # end
776
+ # filename = 'example.rhtml' # @arg1 and @arg2 are used in example.rhtml
777
+ # erb = ERB.new(File.read(filename))
778
+ # erb.filename = filename
779
+ # MyClass = erb.def_class(MyClass_, 'render()')
780
+ # print MyClass.new('foo', 123).render()
781
+ def def_class(superklass=Object, methodname='result')
782
+ cls = Class.new(superklass)
783
+ def_method(cls, methodname, @filename || '(ERB)')
784
+ cls
785
+ end
786
+ end
787
+
788
+ #--
789
+ # ERB::Util
790
+ class ERB
791
+ # A utility module for conversion routines, often handy in HTML generation.
792
+ module Util
793
+ public
794
+ #
795
+ # A utility method for escaping HTML tag characters in _s_.
796
+ #
797
+ # require "erb"
798
+ # include ERB::Util
799
+ #
800
+ # puts html_escape("is a > 0 & a < 10?")
801
+ #
802
+ # _Generates_
803
+ #
804
+ # is a &gt; 0 &amp; a &lt; 10?
805
+ #
806
+ def html_escape(s)
807
+ s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
808
+ end
809
+ alias h html_escape
810
+ module_function :h
811
+ module_function :html_escape
812
+
813
+ #
814
+ # A utility method for encoding the String _s_ as a URL.
815
+ #
816
+ # require "erb"
817
+ # include ERB::Util
818
+ #
819
+ # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
820
+ #
821
+ # _Generates_
822
+ #
823
+ # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
824
+ #
825
+ def url_encode(s)
826
+ s.to_s.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }
827
+ end
828
+ alias u url_encode
829
+ module_function :u
830
+ module_function :url_encode
831
+ end
832
+ end
833
+
834
+ #--
835
+ # ERB::DefMethod
836
+ class ERB
837
+ # Utility module to define eRuby script as instance method.
838
+ #
839
+ # === Example
840
+ #
841
+ # example.rhtml:
842
+ # <% for item in @items %>
843
+ # <b><%= item %></b>
844
+ # <% end %>
845
+ #
846
+ # example.rb:
847
+ # require 'erb'
848
+ # class MyClass
849
+ # extend ERB::DefMethod
850
+ # def_erb_method('render()', 'example.rhtml')
851
+ # def initialize(items)
852
+ # @items = items
853
+ # end
854
+ # end
855
+ # print MyClass.new([10,20,30]).render()
856
+ #
857
+ # result:
858
+ #
859
+ # <b>10</b>
860
+ #
861
+ # <b>20</b>
862
+ #
863
+ # <b>30</b>
864
+ #
865
+ module DefMethod
866
+ public
867
+ # define _methodname_ as instance method of current module, using ERB object or eRuby file
868
+ def def_erb_method(methodname, erb_or_fname)
869
+ if erb_or_fname.kind_of? String
870
+ fname = erb_or_fname
871
+ erb = ERB.new(File.read(fname))
872
+ erb.def_method(self, methodname, fname)
873
+ else
874
+ erb = erb_or_fname
875
+ erb.def_method(self, methodname, erb.filename || '(ERB)')
876
+ end
877
+ end
878
+ module_function :def_erb_method
879
+ end
880
+ end