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,137 @@
1
+ # = Secure random number generator interface.
2
+ #
3
+ # This library is an interface for secure random number generator which is
4
+ # suitable for generating session key in HTTP cookies, etc.
5
+ #
6
+ # It supports following secure random number generators.
7
+ #
8
+ # * openssl
9
+ # * /dev/urandom
10
+ #
11
+ # == Example
12
+ #
13
+ # # random hexadecimal string.
14
+ # p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362"
15
+ # p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559"
16
+ # p SecureRandom.hex(11) #=> "6aca1b5c58e4863e6b81b8"
17
+ # p SecureRandom.hex(12) #=> "94b2fff3e7fd9b9c391a2306"
18
+ # p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23"
19
+ # ...
20
+ #
21
+ # # random base64 string.
22
+ # p SecureRandom.base64(10) #=> "EcmTPZwWRAozdA=="
23
+ # p SecureRandom.base64(10) #=> "9b0nsevdwNuM/w=="
24
+ # p SecureRandom.base64(10) #=> "KO1nIU+p9DKxGg=="
25
+ # p SecureRandom.base64(11) #=> "l7XEiFja+8EKEtY="
26
+ # p SecureRandom.base64(12) #=> "7kJSM/MzBJI+75j8"
27
+ # p SecureRandom.base64(13) #=> "vKLJ0tXBHqQOuIcSIg=="
28
+ # ...
29
+ #
30
+ # # random binary string.
31
+ # p SecureRandom.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
32
+ # p SecureRandom.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
33
+ # ...
34
+
35
+ begin
36
+ require 'openssl'
37
+ rescue LoadError
38
+ end
39
+
40
+ module SecureRandom
41
+ # SecureRandom.random_bytes generates a random binary string.
42
+ #
43
+ # The argument n specifies the length of the result string.
44
+ #
45
+ # If n is not specified, 16 is assumed.
46
+ # It may be larger in future.
47
+ #
48
+ # If secure random number generator is not available,
49
+ # NotImplementedError is raised.
50
+ def self.random_bytes(n=nil)
51
+ n ||= 16
52
+ if defined? OpenSSL::Random
53
+ return OpenSSL::Random.random_bytes(n)
54
+ end
55
+ if !defined?(@has_urandom) || @has_urandom
56
+ @has_urandom = false
57
+ flags = File::RDONLY
58
+ flags |= File::NONBLOCK if defined? File::NONBLOCK
59
+ flags |= File::NOCTTY if defined? File::NOCTTY
60
+ flags |= File::NOFOLLOW if defined? File::NOFOLLOW
61
+ begin
62
+ File.open("/dev/urandom", flags) {|f|
63
+ unless f.stat.chardev?
64
+ raise Errno::ENOENT
65
+ end
66
+ @has_urandom = true
67
+ ret = f.readpartial(n)
68
+ if ret.length != n
69
+ raise NotImplementedError, "Unexpected partial read from random device"
70
+ end
71
+ return ret
72
+ }
73
+ rescue Errno::ENOENT
74
+ raise NotImplementedError, "No random device"
75
+ end
76
+ end
77
+ raise NotImplementedError, "No random device"
78
+ end
79
+
80
+ # SecureRandom.hex generates a random hex string.
81
+ #
82
+ # The argument n specifies the length of the random length.
83
+ # The length of the result string is twice of n.
84
+ #
85
+ # If n is not specified, 16 is assumed.
86
+ # It may be larger in future.
87
+ #
88
+ # If secure random number generator is not available,
89
+ # NotImplementedError is raised.
90
+ def self.hex(n=nil)
91
+ random_bytes(n).unpack("H*")[0]
92
+ end
93
+
94
+ # SecureRandom.base64 generates a random base64 string.
95
+ #
96
+ # The argument n specifies the length of the random length.
97
+ # The length of the result string is about 4/3 of n.
98
+ #
99
+ # If n is not specified, 16 is assumed.
100
+ # It may be larger in future.
101
+ #
102
+ # If secure random number generator is not available,
103
+ # NotImplementedError is raised.
104
+ def self.base64(n=nil)
105
+ [random_bytes(n)].pack("m*").delete("\n")
106
+ end
107
+
108
+ # SecureRandom.random_number generates a random number.
109
+ #
110
+ # If an positive integer is given as n,
111
+ # SecureRandom.random_number returns an integer:
112
+ # 0 <= SecureRandom.random_number(n) < n.
113
+ #
114
+ # If 0 is given or an argument is not given,
115
+ # SecureRandom.random_number returns an float:
116
+ # 0.0 <= SecureRandom.random_number() < 1.0.
117
+ def self.random_number(n=0)
118
+ if 0 < n
119
+ hex = n.to_s(16)
120
+ hex = '0' + hex if (hex.length & 1) == 1
121
+ bin = [hex].pack("H*")
122
+ mask = bin[0]
123
+ mask |= mask >> 1
124
+ mask |= mask >> 2
125
+ mask |= mask >> 4
126
+ begin
127
+ rnd = SecureRandom.random_bytes(bin.length)
128
+ rnd[0] = (rnd[0] & mask).chr
129
+ end until rnd < bin
130
+ rnd.unpack("H*")[0].hex
131
+ else
132
+ # assumption: Float::MANT_DIG <= 64
133
+ i64 = SecureRandom.random_bytes(8).unpack("Q")[0]
134
+ Math.ldexp(i64 >> (64-Float::MANT_DIG), -Float::MANT_DIG)
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,1233 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # set.rb - defines the Set class
4
+ #++
5
+ # Copyright (c) 2002-2008 Akinori MUSHA <knu@iDaemons.org>
6
+ #
7
+ # Documentation by Akinori MUSHA and Gavin Sinclair.
8
+ #
9
+ # All rights reserved. You can redistribute and/or modify it under the same
10
+ # terms as Ruby.
11
+ #
12
+ # $Id: set.rb 16171 2008-04-23 05:18:50Z knu $
13
+ #
14
+ # == Overview
15
+ #
16
+ # This library provides the Set class, which deals with a collection
17
+ # of unordered values with no duplicates. It is a hybrid of Array's
18
+ # intuitive inter-operation facilities and Hash's fast lookup. If you
19
+ # need to keep values ordered, use the SortedSet class.
20
+ #
21
+ # The method +to_set+ is added to Enumerable for convenience.
22
+ #
23
+ # See the Set class for an example of usage.
24
+
25
+
26
+ #
27
+ # Set implements a collection of unordered values with no duplicates.
28
+ # This is a hybrid of Array's intuitive inter-operation facilities and
29
+ # Hash's fast lookup.
30
+ #
31
+ # Several methods accept any Enumerable object (implementing +each+)
32
+ # for greater flexibility: new, replace, merge, subtract, |, &, -, ^.
33
+ #
34
+ # The equality of each couple of elements is determined according to
35
+ # Object#eql? and Object#hash, since Set uses Hash as storage.
36
+ #
37
+ # Finally, if you are using class Set, you can also use Enumerable#to_set
38
+ # for convenience.
39
+ #
40
+ # == Example
41
+ #
42
+ # require 'set'
43
+ # s1 = Set.new [1, 2] # -> #<Set: {1, 2}>
44
+ # s2 = [1, 2].to_set # -> #<Set: {1, 2}>
45
+ # s1 == s2 # -> true
46
+ # s1.add("foo") # -> #<Set: {1, 2, "foo"}>
47
+ # s1.merge([2, 6]) # -> #<Set: {6, 1, 2, "foo"}>
48
+ # s1.subset? s2 # -> false
49
+ # s2.subset? s1 # -> true
50
+ #
51
+ # == Contact
52
+ #
53
+ # - Akinori MUSHA <knu@iDaemons.org> (current maintainer)
54
+ #
55
+ class Set
56
+ include Enumerable
57
+
58
+ # Creates a new set containing the given objects.
59
+ def self.[](*ary)
60
+ new(ary)
61
+ end
62
+
63
+ # Creates a new set containing the elements of the given enumerable
64
+ # object.
65
+ #
66
+ # If a block is given, the elements of enum are preprocessed by the
67
+ # given block.
68
+ def initialize(enum = nil, &block) # :yields: o
69
+ @hash ||= Hash.new
70
+
71
+ enum.nil? and return
72
+
73
+ if block
74
+ enum.each { |o| add(block[o]) }
75
+ else
76
+ merge(enum)
77
+ end
78
+ end
79
+
80
+ # Copy internal hash.
81
+ def initialize_copy(orig)
82
+ @hash = orig.instance_eval{@hash}.dup
83
+ end
84
+
85
+ # Returns the number of elements.
86
+ def size
87
+ @hash.size
88
+ end
89
+ alias length size
90
+
91
+ # Returns true if the set contains no elements.
92
+ def empty?
93
+ @hash.empty?
94
+ end
95
+
96
+ # Removes all elements and returns self.
97
+ def clear
98
+ @hash.clear
99
+ self
100
+ end
101
+
102
+ # Replaces the contents of the set with the contents of the given
103
+ # enumerable object and returns self.
104
+ def replace(enum)
105
+ if enum.class == self.class
106
+ @hash.replace(enum.instance_eval { @hash })
107
+ else
108
+ enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
109
+ clear
110
+ enum.each { |o| add(o) }
111
+ end
112
+
113
+ self
114
+ end
115
+
116
+ # Converts the set to an array. The order of elements is uncertain.
117
+ def to_a
118
+ @hash.keys
119
+ end
120
+
121
+ def flatten_merge(set, seen = Set.new)
122
+ set.each { |e|
123
+ if e.is_a?(Set)
124
+ if seen.include?(e_id = e.object_id)
125
+ raise ArgumentError, "tried to flatten recursive Set"
126
+ end
127
+
128
+ seen.add(e_id)
129
+ flatten_merge(e, seen)
130
+ seen.delete(e_id)
131
+ else
132
+ add(e)
133
+ end
134
+ }
135
+
136
+ self
137
+ end
138
+ protected :flatten_merge
139
+
140
+ # Returns a new set that is a copy of the set, flattening each
141
+ # containing set recursively.
142
+ def flatten
143
+ self.class.new.flatten_merge(self)
144
+ end
145
+
146
+ # Equivalent to Set#flatten, but replaces the receiver with the
147
+ # result in place. Returns nil if no modifications were made.
148
+ def flatten!
149
+ if detect { |e| e.is_a?(Set) }
150
+ replace(flatten())
151
+ else
152
+ nil
153
+ end
154
+ end
155
+
156
+ # Returns true if the set contains the given object.
157
+ def include?(o)
158
+ @hash.include?(o)
159
+ end
160
+ alias member? include?
161
+
162
+ # Returns true if the set is a superset of the given set.
163
+ def superset?(set)
164
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
165
+ return false if size < set.size
166
+ set.all? { |o| include?(o) }
167
+ end
168
+
169
+ # Returns true if the set is a proper superset of the given set.
170
+ def proper_superset?(set)
171
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
172
+ return false if size <= set.size
173
+ set.all? { |o| include?(o) }
174
+ end
175
+
176
+ # Returns true if the set is a subset of the given set.
177
+ def subset?(set)
178
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
179
+ return false if set.size < size
180
+ all? { |o| set.include?(o) }
181
+ end
182
+
183
+ # Returns true if the set is a proper subset of the given set.
184
+ def proper_subset?(set)
185
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
186
+ return false if set.size <= size
187
+ all? { |o| set.include?(o) }
188
+ end
189
+
190
+ # Calls the given block once for each element in the set, passing
191
+ # the element as parameter. Returns an enumerator if no block is
192
+ # given.
193
+ def each
194
+ block_given? or return enum_for(__method__)
195
+ @hash.each_key { |o| yield(o) }
196
+ self
197
+ end
198
+
199
+ # Adds the given object to the set and returns self. Use +merge+ to
200
+ # add several elements at once.
201
+ def add(o)
202
+ @hash[o] = true
203
+ self
204
+ end
205
+ alias << add
206
+
207
+ # Adds the given object to the set and returns self. If the
208
+ # object is already in the set, returns nil.
209
+ def add?(o)
210
+ if include?(o)
211
+ nil
212
+ else
213
+ add(o)
214
+ end
215
+ end
216
+
217
+ # Deletes the given object from the set and returns self. Use +subtract+ to
218
+ # delete several items at once.
219
+ def delete(o)
220
+ @hash.delete(o)
221
+ self
222
+ end
223
+
224
+ # Deletes the given object from the set and returns self. If the
225
+ # object is not in the set, returns nil.
226
+ def delete?(o)
227
+ if include?(o)
228
+ delete(o)
229
+ else
230
+ nil
231
+ end
232
+ end
233
+
234
+ # Deletes every element of the set for which block evaluates to
235
+ # true, and returns self.
236
+ def delete_if
237
+ @hash.delete_if { |o,| yield(o) }
238
+ self
239
+ end
240
+
241
+ # Do collect() destructively.
242
+ def collect!
243
+ set = self.class.new
244
+ each { |o| set << yield(o) }
245
+ replace(set)
246
+ end
247
+ alias map! collect!
248
+
249
+ # Equivalent to Set#delete_if, but returns nil if no changes were
250
+ # made.
251
+ def reject!
252
+ n = size
253
+ delete_if { |o| yield(o) }
254
+ size == n ? nil : self
255
+ end
256
+
257
+ # Merges the elements of the given enumerable object to the set and
258
+ # returns self.
259
+ def merge(enum)
260
+ if enum.is_a?(Set)
261
+ @hash.update(enum.instance_eval { @hash })
262
+ else
263
+ enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
264
+ enum.each { |o| add(o) }
265
+ end
266
+
267
+ self
268
+ end
269
+
270
+ # Deletes every element that appears in the given enumerable object
271
+ # and returns self.
272
+ def subtract(enum)
273
+ enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
274
+ enum.each { |o| delete(o) }
275
+ self
276
+ end
277
+
278
+ # Returns a new set built by merging the set and the elements of the
279
+ # given enumerable object.
280
+ def |(enum)
281
+ enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
282
+ dup.merge(enum)
283
+ end
284
+ alias + | ##
285
+ alias union | ##
286
+
287
+ # Returns a new set built by duplicating the set, removing every
288
+ # element that appears in the given enumerable object.
289
+ def -(enum)
290
+ enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
291
+ dup.subtract(enum)
292
+ end
293
+ alias difference - ##
294
+
295
+ # Returns a new set containing elements common to the set and the
296
+ # given enumerable object.
297
+ def &(enum)
298
+ enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
299
+ n = self.class.new
300
+ enum.each { |o| n.add(o) if include?(o) }
301
+ n
302
+ end
303
+ alias intersection & ##
304
+
305
+ # Returns a new set containing elements exclusive between the set
306
+ # and the given enumerable object. (set ^ enum) is equivalent to
307
+ # ((set | enum) - (set & enum)).
308
+ def ^(enum)
309
+ enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
310
+ n = Set.new(enum)
311
+ each { |o| if n.include?(o) then n.delete(o) else n.add(o) end }
312
+ n
313
+ end
314
+
315
+ # Returns true if two sets are equal. The equality of each couple
316
+ # of elements is defined according to Object#eql?.
317
+ def ==(set)
318
+ equal?(set) and return true
319
+
320
+ set.is_a?(Set) && size == set.size or return false
321
+
322
+ hash = @hash.dup
323
+ set.all? { |o| hash.include?(o) }
324
+ end
325
+
326
+ def hash # :nodoc:
327
+ @hash.hash
328
+ end
329
+
330
+ def eql?(o) # :nodoc:
331
+ return false unless o.is_a?(Set)
332
+ @hash.eql?(o.instance_eval{@hash})
333
+ end
334
+
335
+ # Classifies the set by the return value of the given block and
336
+ # returns a hash of {value => set of elements} pairs. The block is
337
+ # called once for each element of the set, passing the element as
338
+ # parameter.
339
+ #
340
+ # e.g.:
341
+ #
342
+ # require 'set'
343
+ # files = Set.new(Dir.glob("*.rb"))
344
+ # hash = files.classify { |f| File.mtime(f).year }
345
+ # p hash # => {2000=>#<Set: {"a.rb", "b.rb"}>,
346
+ # # 2001=>#<Set: {"c.rb", "d.rb", "e.rb"}>,
347
+ # # 2002=>#<Set: {"f.rb"}>}
348
+ def classify # :yields: o
349
+ h = {}
350
+
351
+ each { |i|
352
+ x = yield(i)
353
+ (h[x] ||= self.class.new).add(i)
354
+ }
355
+
356
+ h
357
+ end
358
+
359
+ # Divides the set into a set of subsets according to the commonality
360
+ # defined by the given block.
361
+ #
362
+ # If the arity of the block is 2, elements o1 and o2 are in common
363
+ # if block.call(o1, o2) is true. Otherwise, elements o1 and o2 are
364
+ # in common if block.call(o1) == block.call(o2).
365
+ #
366
+ # e.g.:
367
+ #
368
+ # require 'set'
369
+ # numbers = Set[1, 3, 4, 6, 9, 10, 11]
370
+ # set = numbers.divide { |i,j| (i - j).abs == 1 }
371
+ # p set # => #<Set: {#<Set: {1}>,
372
+ # # #<Set: {11, 9, 10}>,
373
+ # # #<Set: {3, 4}>,
374
+ # # #<Set: {6}>}>
375
+ def divide(&func)
376
+ if func.arity == 2
377
+ require 'tsort'
378
+
379
+ class << dig = {} # :nodoc:
380
+ include TSort
381
+
382
+ alias tsort_each_node each_key
383
+ def tsort_each_child(node, &block)
384
+ fetch(node).each(&block)
385
+ end
386
+ end
387
+
388
+ each { |u|
389
+ dig[u] = a = []
390
+ each{ |v| func.call(u, v) and a << v }
391
+ }
392
+
393
+ set = Set.new()
394
+ dig.each_strongly_connected_component { |css|
395
+ set.add(self.class.new(css))
396
+ }
397
+ set
398
+ else
399
+ Set.new(classify(&func).values)
400
+ end
401
+ end
402
+
403
+ InspectKey = :__inspect_key__ # :nodoc:
404
+
405
+ # Returns a string containing a human-readable representation of the
406
+ # set. ("#<Set: {element1, element2, ...}>")
407
+ def inspect
408
+ ids = (Thread.current[InspectKey] ||= [])
409
+
410
+ if ids.include?(object_id)
411
+ return sprintf('#<%s: {...}>', self.class.name)
412
+ end
413
+
414
+ begin
415
+ ids << object_id
416
+ return sprintf('#<%s: {%s}>', self.class, to_a.inspect[1..-2])
417
+ ensure
418
+ ids.pop
419
+ end
420
+ end
421
+
422
+ def pretty_print(pp) # :nodoc:
423
+ pp.text sprintf('#<%s: {', self.class.name)
424
+ pp.nest(1) {
425
+ pp.seplist(self) { |o|
426
+ pp.pp o
427
+ }
428
+ }
429
+ pp.text "}>"
430
+ end
431
+
432
+ def pretty_print_cycle(pp) # :nodoc:
433
+ pp.text sprintf('#<%s: {%s}>', self.class.name, empty? ? '' : '...')
434
+ end
435
+ end
436
+
437
+ # SortedSet implements a set which elements are sorted in order. See Set.
438
+ class SortedSet < Set
439
+ @@setup = false
440
+
441
+ class << self
442
+ def [](*ary) # :nodoc:
443
+ new(ary)
444
+ end
445
+
446
+ def setup # :nodoc:
447
+ @@setup and return
448
+
449
+ module_eval {
450
+ # a hack to shut up warning
451
+ alias old_init initialize
452
+ remove_method :old_init
453
+ }
454
+ begin
455
+ require 'rbtree'
456
+
457
+ module_eval %{
458
+ def initialize(*args, &block)
459
+ @hash = RBTree.new
460
+ super
461
+ end
462
+ }
463
+ rescue LoadError
464
+ module_eval %{
465
+ def initialize(*args, &block)
466
+ @keys = nil
467
+ super
468
+ end
469
+
470
+ def clear
471
+ @keys = nil
472
+ super
473
+ end
474
+
475
+ def replace(enum)
476
+ @keys = nil
477
+ super
478
+ end
479
+
480
+ def add(o)
481
+ @keys = nil
482
+ @hash[o] = true
483
+ self
484
+ end
485
+ alias << add
486
+
487
+ def delete(o)
488
+ @keys = nil
489
+ @hash.delete(o)
490
+ self
491
+ end
492
+
493
+ def delete_if
494
+ n = @hash.size
495
+ @hash.delete_if { |o,| yield(o) }
496
+ @keys = nil if @hash.size != n
497
+ self
498
+ end
499
+
500
+ def merge(enum)
501
+ @keys = nil
502
+ super
503
+ end
504
+
505
+ def each
506
+ block_given? or return enum_for(__method__)
507
+ to_a.each { |o| yield(o) }
508
+ end
509
+
510
+ def to_a
511
+ (@keys = @hash.keys).sort! unless @keys
512
+ @keys
513
+ end
514
+ }
515
+ end
516
+
517
+ @@setup = true
518
+ end
519
+ end
520
+
521
+ def initialize(*args, &block) # :nodoc:
522
+ SortedSet.setup
523
+ initialize(*args, &block)
524
+ end
525
+ end
526
+
527
+ module Enumerable
528
+ # Makes a set from the enumerable object with given arguments.
529
+ # Needs to +require "set"+ to use this method.
530
+ def to_set(klass = Set, *args, &block)
531
+ klass.new(self, *args, &block)
532
+ end
533
+ end
534
+
535
+ # =begin
536
+ # == RestricedSet class
537
+ # RestricedSet implements a set with restrictions defined by a given
538
+ # block.
539
+ #
540
+ # === Super class
541
+ # Set
542
+ #
543
+ # === Class Methods
544
+ # --- RestricedSet::new(enum = nil) { |o| ... }
545
+ # --- RestricedSet::new(enum = nil) { |rset, o| ... }
546
+ # Creates a new restricted set containing the elements of the given
547
+ # enumerable object. Restrictions are defined by the given block.
548
+ #
549
+ # If the block's arity is 2, it is called with the RestrictedSet
550
+ # itself and an object to see if the object is allowed to be put in
551
+ # the set.
552
+ #
553
+ # Otherwise, the block is called with an object to see if the object
554
+ # is allowed to be put in the set.
555
+ #
556
+ # === Instance Methods
557
+ # --- restriction_proc
558
+ # Returns the restriction procedure of the set.
559
+ #
560
+ # =end
561
+ #
562
+ # class RestricedSet < Set
563
+ # def initialize(*args, &block)
564
+ # @proc = block or raise ArgumentError, "missing a block"
565
+ #
566
+ # if @proc.arity == 2
567
+ # instance_eval %{
568
+ # def add(o)
569
+ # @hash[o] = true if @proc.call(self, o)
570
+ # self
571
+ # end
572
+ # alias << add
573
+ #
574
+ # def add?(o)
575
+ # if include?(o) || !@proc.call(self, o)
576
+ # nil
577
+ # else
578
+ # @hash[o] = true
579
+ # self
580
+ # end
581
+ # end
582
+ #
583
+ # def replace(enum)
584
+ # enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
585
+ # clear
586
+ # enum.each { |o| add(o) }
587
+ #
588
+ # self
589
+ # end
590
+ #
591
+ # def merge(enum)
592
+ # enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
593
+ # enum.each { |o| add(o) }
594
+ #
595
+ # self
596
+ # end
597
+ # }
598
+ # else
599
+ # instance_eval %{
600
+ # def add(o)
601
+ # if @proc.call(o)
602
+ # @hash[o] = true
603
+ # end
604
+ # self
605
+ # end
606
+ # alias << add
607
+ #
608
+ # def add?(o)
609
+ # if include?(o) || !@proc.call(o)
610
+ # nil
611
+ # else
612
+ # @hash[o] = true
613
+ # self
614
+ # end
615
+ # end
616
+ # }
617
+ # end
618
+ #
619
+ # super(*args)
620
+ # end
621
+ #
622
+ # def restriction_proc
623
+ # @proc
624
+ # end
625
+ # end
626
+
627
+ if $0 == __FILE__
628
+ eval DATA.read, nil, $0, __LINE__+4
629
+ end
630
+
631
+ __END__
632
+
633
+ require 'test/unit'
634
+
635
+ class TC_Set < Test::Unit::TestCase
636
+ def test_aref
637
+ assert_nothing_raised {
638
+ Set[]
639
+ Set[nil]
640
+ Set[1,2,3]
641
+ }
642
+
643
+ assert_equal(0, Set[].size)
644
+ assert_equal(1, Set[nil].size)
645
+ assert_equal(1, Set[[]].size)
646
+ assert_equal(1, Set[[nil]].size)
647
+
648
+ set = Set[2,4,6,4]
649
+ assert_equal(Set.new([2,4,6]), set)
650
+ end
651
+
652
+ def test_s_new
653
+ assert_nothing_raised {
654
+ Set.new()
655
+ Set.new(nil)
656
+ Set.new([])
657
+ Set.new([1,2])
658
+ Set.new('a'..'c')
659
+ Set.new('XYZ')
660
+ }
661
+ assert_raises(ArgumentError) {
662
+ Set.new(false)
663
+ }
664
+ assert_raises(ArgumentError) {
665
+ Set.new(1)
666
+ }
667
+ assert_raises(ArgumentError) {
668
+ Set.new(1,2)
669
+ }
670
+
671
+ assert_equal(0, Set.new().size)
672
+ assert_equal(0, Set.new(nil).size)
673
+ assert_equal(0, Set.new([]).size)
674
+ assert_equal(1, Set.new([nil]).size)
675
+
676
+ ary = [2,4,6,4]
677
+ set = Set.new(ary)
678
+ ary.clear
679
+ assert_equal(false, set.empty?)
680
+ assert_equal(3, set.size)
681
+
682
+ ary = [1,2,3]
683
+
684
+ s = Set.new(ary) { |o| o * 2 }
685
+ assert_equal([2,4,6], s.sort)
686
+ end
687
+
688
+ def test_clone
689
+ set1 = Set.new
690
+ set2 = set1.clone
691
+ set1 << 'abc'
692
+ assert_equal(Set.new, set2)
693
+ end
694
+
695
+ def test_dup
696
+ set1 = Set[1,2]
697
+ set2 = set1.dup
698
+
699
+ assert_not_same(set1, set2)
700
+
701
+ assert_equal(set1, set2)
702
+
703
+ set1.add(3)
704
+
705
+ assert_not_equal(set1, set2)
706
+ end
707
+
708
+ def test_size
709
+ assert_equal(0, Set[].size)
710
+ assert_equal(2, Set[1,2].size)
711
+ assert_equal(2, Set[1,2,1].size)
712
+ end
713
+
714
+ def test_empty?
715
+ assert_equal(true, Set[].empty?)
716
+ assert_equal(false, Set[1, 2].empty?)
717
+ end
718
+
719
+ def test_clear
720
+ set = Set[1,2]
721
+ ret = set.clear
722
+
723
+ assert_same(set, ret)
724
+ assert_equal(true, set.empty?)
725
+ end
726
+
727
+ def test_replace
728
+ set = Set[1,2]
729
+ ret = set.replace('a'..'c')
730
+
731
+ assert_same(set, ret)
732
+ assert_equal(Set['a','b','c'], set)
733
+ end
734
+
735
+ def test_to_a
736
+ set = Set[1,2,3,2]
737
+ ary = set.to_a
738
+
739
+ assert_equal([1,2,3], ary.sort)
740
+ end
741
+
742
+ def test_flatten
743
+ # test1
744
+ set1 = Set[
745
+ 1,
746
+ Set[
747
+ 5,
748
+ Set[7,
749
+ Set[0]
750
+ ],
751
+ Set[6,2],
752
+ 1
753
+ ],
754
+ 3,
755
+ Set[3,4]
756
+ ]
757
+
758
+ set2 = set1.flatten
759
+ set3 = Set.new(0..7)
760
+
761
+ assert_not_same(set2, set1)
762
+ assert_equal(set3, set2)
763
+
764
+ # test2; destructive
765
+ orig_set1 = set1
766
+ set1.flatten!
767
+
768
+ assert_same(orig_set1, set1)
769
+ assert_equal(set3, set1)
770
+
771
+ # test3; multiple occurrences of a set in an set
772
+ set1 = Set[1, 2]
773
+ set2 = Set[set1, Set[set1, 4], 3]
774
+
775
+ assert_nothing_raised {
776
+ set2.flatten!
777
+ }
778
+
779
+ assert_equal(Set.new(1..4), set2)
780
+
781
+ # test4; recursion
782
+ set2 = Set[]
783
+ set1 = Set[1, set2]
784
+ set2.add(set1)
785
+
786
+ assert_raises(ArgumentError) {
787
+ set1.flatten!
788
+ }
789
+
790
+ # test5; miscellaneous
791
+ empty = Set[]
792
+ set = Set[Set[empty, "a"],Set[empty, "b"]]
793
+
794
+ assert_nothing_raised {
795
+ set.flatten
796
+ }
797
+
798
+ set1 = empty.merge(Set["no_more", set])
799
+
800
+ assert_nil(Set.new(0..31).flatten!)
801
+
802
+ x = Set[Set[],Set[1,2]].flatten!
803
+ y = Set[1,2]
804
+
805
+ assert_equal(x, y)
806
+ end
807
+
808
+ def test_include?
809
+ set = Set[1,2,3]
810
+
811
+ assert_equal(true, set.include?(1))
812
+ assert_equal(true, set.include?(2))
813
+ assert_equal(true, set.include?(3))
814
+ assert_equal(false, set.include?(0))
815
+ assert_equal(false, set.include?(nil))
816
+
817
+ set = Set["1",nil,"2",nil,"0","1",false]
818
+ assert_equal(true, set.include?(nil))
819
+ assert_equal(true, set.include?(false))
820
+ assert_equal(true, set.include?("1"))
821
+ assert_equal(false, set.include?(0))
822
+ assert_equal(false, set.include?(true))
823
+ end
824
+
825
+ def test_superset?
826
+ set = Set[1,2,3]
827
+
828
+ assert_raises(ArgumentError) {
829
+ set.superset?()
830
+ }
831
+
832
+ assert_raises(ArgumentError) {
833
+ set.superset?(2)
834
+ }
835
+
836
+ assert_raises(ArgumentError) {
837
+ set.superset?([2])
838
+ }
839
+
840
+ assert_equal(true, set.superset?(Set[]))
841
+ assert_equal(true, set.superset?(Set[1,2]))
842
+ assert_equal(true, set.superset?(Set[1,2,3]))
843
+ assert_equal(false, set.superset?(Set[1,2,3,4]))
844
+ assert_equal(false, set.superset?(Set[1,4]))
845
+
846
+ assert_equal(true, Set[].superset?(Set[]))
847
+ end
848
+
849
+ def test_proper_superset?
850
+ set = Set[1,2,3]
851
+
852
+ assert_raises(ArgumentError) {
853
+ set.proper_superset?()
854
+ }
855
+
856
+ assert_raises(ArgumentError) {
857
+ set.proper_superset?(2)
858
+ }
859
+
860
+ assert_raises(ArgumentError) {
861
+ set.proper_superset?([2])
862
+ }
863
+
864
+ assert_equal(true, set.proper_superset?(Set[]))
865
+ assert_equal(true, set.proper_superset?(Set[1,2]))
866
+ assert_equal(false, set.proper_superset?(Set[1,2,3]))
867
+ assert_equal(false, set.proper_superset?(Set[1,2,3,4]))
868
+ assert_equal(false, set.proper_superset?(Set[1,4]))
869
+
870
+ assert_equal(false, Set[].proper_superset?(Set[]))
871
+ end
872
+
873
+ def test_subset?
874
+ set = Set[1,2,3]
875
+
876
+ assert_raises(ArgumentError) {
877
+ set.subset?()
878
+ }
879
+
880
+ assert_raises(ArgumentError) {
881
+ set.subset?(2)
882
+ }
883
+
884
+ assert_raises(ArgumentError) {
885
+ set.subset?([2])
886
+ }
887
+
888
+ assert_equal(true, set.subset?(Set[1,2,3,4]))
889
+ assert_equal(true, set.subset?(Set[1,2,3]))
890
+ assert_equal(false, set.subset?(Set[1,2]))
891
+ assert_equal(false, set.subset?(Set[]))
892
+
893
+ assert_equal(true, Set[].subset?(Set[1]))
894
+ assert_equal(true, Set[].subset?(Set[]))
895
+ end
896
+
897
+ def test_proper_subset?
898
+ set = Set[1,2,3]
899
+
900
+ assert_raises(ArgumentError) {
901
+ set.proper_subset?()
902
+ }
903
+
904
+ assert_raises(ArgumentError) {
905
+ set.proper_subset?(2)
906
+ }
907
+
908
+ assert_raises(ArgumentError) {
909
+ set.proper_subset?([2])
910
+ }
911
+
912
+ assert_equal(true, set.proper_subset?(Set[1,2,3,4]))
913
+ assert_equal(false, set.proper_subset?(Set[1,2,3]))
914
+ assert_equal(false, set.proper_subset?(Set[1,2]))
915
+ assert_equal(false, set.proper_subset?(Set[]))
916
+
917
+ assert_equal(false, Set[].proper_subset?(Set[]))
918
+ end
919
+
920
+ def test_each
921
+ ary = [1,3,5,7,10,20]
922
+ set = Set.new(ary)
923
+
924
+ e = set.each
925
+ assert_instance_of(Enumerable::Enumerator, e)
926
+
927
+ assert_nothing_raised {
928
+ set.each { |o|
929
+ ary.delete(o) or raise "unexpected element: #{o}"
930
+ }
931
+
932
+ ary.empty? or raise "forgotten elements: #{ary.join(', ')}"
933
+ }
934
+ end
935
+
936
+ def test_add
937
+ set = Set[1,2,3]
938
+
939
+ ret = set.add(2)
940
+ assert_same(set, ret)
941
+ assert_equal(Set[1,2,3], set)
942
+
943
+ ret = set.add?(2)
944
+ assert_nil(ret)
945
+ assert_equal(Set[1,2,3], set)
946
+
947
+ ret = set.add(4)
948
+ assert_same(set, ret)
949
+ assert_equal(Set[1,2,3,4], set)
950
+
951
+ ret = set.add?(5)
952
+ assert_same(set, ret)
953
+ assert_equal(Set[1,2,3,4,5], set)
954
+ end
955
+
956
+ def test_delete
957
+ set = Set[1,2,3]
958
+
959
+ ret = set.delete(4)
960
+ assert_same(set, ret)
961
+ assert_equal(Set[1,2,3], set)
962
+
963
+ ret = set.delete?(4)
964
+ assert_nil(ret)
965
+ assert_equal(Set[1,2,3], set)
966
+
967
+ ret = set.delete(2)
968
+ assert_equal(set, ret)
969
+ assert_equal(Set[1,3], set)
970
+
971
+ ret = set.delete?(1)
972
+ assert_equal(set, ret)
973
+ assert_equal(Set[3], set)
974
+ end
975
+
976
+ def test_delete_if
977
+ set = Set.new(1..10)
978
+ ret = set.delete_if { |i| i > 10 }
979
+ assert_same(set, ret)
980
+ assert_equal(Set.new(1..10), set)
981
+
982
+ set = Set.new(1..10)
983
+ ret = set.delete_if { |i| i % 3 == 0 }
984
+ assert_same(set, ret)
985
+ assert_equal(Set[1,2,4,5,7,8,10], set)
986
+ end
987
+
988
+ def test_collect!
989
+ set = Set[1,2,3,'a','b','c',-1..1,2..4]
990
+
991
+ ret = set.collect! { |i|
992
+ case i
993
+ when Numeric
994
+ i * 2
995
+ when String
996
+ i.upcase
997
+ else
998
+ nil
999
+ end
1000
+ }
1001
+
1002
+ assert_same(set, ret)
1003
+ assert_equal(Set[2,4,6,'A','B','C',nil], set)
1004
+ end
1005
+
1006
+ def test_reject!
1007
+ set = Set.new(1..10)
1008
+
1009
+ ret = set.reject! { |i| i > 10 }
1010
+ assert_nil(ret)
1011
+ assert_equal(Set.new(1..10), set)
1012
+
1013
+ ret = set.reject! { |i| i % 3 == 0 }
1014
+ assert_same(set, ret)
1015
+ assert_equal(Set[1,2,4,5,7,8,10], set)
1016
+ end
1017
+
1018
+ def test_merge
1019
+ set = Set[1,2,3]
1020
+
1021
+ ret = set.merge([2,4,6])
1022
+ assert_same(set, ret)
1023
+ assert_equal(Set[1,2,3,4,6], set)
1024
+ end
1025
+
1026
+ def test_subtract
1027
+ set = Set[1,2,3]
1028
+
1029
+ ret = set.subtract([2,4,6])
1030
+ assert_same(set, ret)
1031
+ assert_equal(Set[1,3], set)
1032
+ end
1033
+
1034
+ def test_plus
1035
+ set = Set[1,2,3]
1036
+
1037
+ ret = set + [2,4,6]
1038
+ assert_not_same(set, ret)
1039
+ assert_equal(Set[1,2,3,4,6], ret)
1040
+ end
1041
+
1042
+ def test_minus
1043
+ set = Set[1,2,3]
1044
+
1045
+ ret = set - [2,4,6]
1046
+ assert_not_same(set, ret)
1047
+ assert_equal(Set[1,3], ret)
1048
+ end
1049
+
1050
+ def test_and
1051
+ set = Set[1,2,3,4]
1052
+
1053
+ ret = set & [2,4,6]
1054
+ assert_not_same(set, ret)
1055
+ assert_equal(Set[2,4], ret)
1056
+ end
1057
+
1058
+ def test_xor
1059
+ set = Set[1,2,3,4]
1060
+ ret = set ^ [2,4,5,5]
1061
+ assert_not_same(set, ret)
1062
+ assert_equal(Set[1,3,5], ret)
1063
+ end
1064
+
1065
+ def test_eq
1066
+ set1 = Set[2,3,1]
1067
+ set2 = Set[1,2,3]
1068
+
1069
+ assert_equal(set1, set1)
1070
+ assert_equal(set1, set2)
1071
+ assert_not_equal(Set[1], [1])
1072
+
1073
+ set1 = Class.new(Set)["a", "b"]
1074
+ set2 = Set["a", "b", set1]
1075
+ set1 = set1.add(set1.clone)
1076
+
1077
+ # assert_equal(set1, set2)
1078
+ # assert_equal(set2, set1)
1079
+ assert_equal(set2, set2.clone)
1080
+ assert_equal(set1.clone, set1)
1081
+
1082
+ assert_not_equal(Set[Exception.new,nil], Set[Exception.new,Exception.new], "[ruby-dev:26127]")
1083
+ end
1084
+
1085
+ # def test_hash
1086
+ # end
1087
+
1088
+ # def test_eql?
1089
+ # end
1090
+
1091
+ def test_classify
1092
+ set = Set.new(1..10)
1093
+ ret = set.classify { |i| i % 3 }
1094
+
1095
+ assert_equal(3, ret.size)
1096
+ assert_instance_of(Hash, ret)
1097
+ ret.each_value { |value| assert_instance_of(Set, value) }
1098
+ assert_equal(Set[3,6,9], ret[0])
1099
+ assert_equal(Set[1,4,7,10], ret[1])
1100
+ assert_equal(Set[2,5,8], ret[2])
1101
+ end
1102
+
1103
+ def test_divide
1104
+ set = Set.new(1..10)
1105
+ ret = set.divide { |i| i % 3 }
1106
+
1107
+ assert_equal(3, ret.size)
1108
+ n = 0
1109
+ ret.each { |s| n += s.size }
1110
+ assert_equal(set.size, n)
1111
+ assert_equal(set, ret.flatten)
1112
+
1113
+ set = Set[7,10,5,11,1,3,4,9,0]
1114
+ ret = set.divide { |a,b| (a - b).abs == 1 }
1115
+
1116
+ assert_equal(4, ret.size)
1117
+ n = 0
1118
+ ret.each { |s| n += s.size }
1119
+ assert_equal(set.size, n)
1120
+ assert_equal(set, ret.flatten)
1121
+ ret.each { |s|
1122
+ if s.include?(0)
1123
+ assert_equal(Set[0,1], s)
1124
+ elsif s.include?(3)
1125
+ assert_equal(Set[3,4,5], s)
1126
+ elsif s.include?(7)
1127
+ assert_equal(Set[7], s)
1128
+ elsif s.include?(9)
1129
+ assert_equal(Set[9,10,11], s)
1130
+ else
1131
+ raise "unexpected group: #{s.inspect}"
1132
+ end
1133
+ }
1134
+ end
1135
+
1136
+ def test_inspect
1137
+ set1 = Set[1]
1138
+
1139
+ assert_equal('#<Set: {1}>', set1.inspect)
1140
+
1141
+ set2 = Set[Set[0], 1, 2, set1]
1142
+ assert_equal(false, set2.inspect.include?('#<Set: {...}>'))
1143
+
1144
+ set1.add(set2)
1145
+ assert_equal(true, set1.inspect.include?('#<Set: {...}>'))
1146
+ end
1147
+
1148
+ # def test_pretty_print
1149
+ # end
1150
+
1151
+ # def test_pretty_print_cycle
1152
+ # end
1153
+ end
1154
+
1155
+ class TC_SortedSet < Test::Unit::TestCase
1156
+ def test_sortedset
1157
+ s = SortedSet[4,5,3,1,2]
1158
+
1159
+ assert_equal([1,2,3,4,5], s.to_a)
1160
+
1161
+ prev = nil
1162
+ s.each { |o| assert(prev < o) if prev; prev = o }
1163
+ assert_not_nil(prev)
1164
+
1165
+ s.map! { |o| -2 * o }
1166
+
1167
+ assert_equal([-10,-8,-6,-4,-2], s.to_a)
1168
+
1169
+ prev = nil
1170
+ s.each { |o| assert(prev < o) if prev; prev = o }
1171
+ assert_not_nil(prev)
1172
+
1173
+ s = SortedSet.new([2,1,3]) { |o| o * -2 }
1174
+ assert_equal([-6,-4,-2], s.to_a)
1175
+ end
1176
+ end
1177
+
1178
+ class TC_Enumerable < Test::Unit::TestCase
1179
+ def test_to_set
1180
+ ary = [2,5,4,3,2,1,3]
1181
+
1182
+ set = ary.to_set
1183
+ assert_instance_of(Set, set)
1184
+ assert_equal([1,2,3,4,5], set.sort)
1185
+
1186
+ set = ary.to_set { |o| o * -2 }
1187
+ assert_instance_of(Set, set)
1188
+ assert_equal([-10,-8,-6,-4,-2], set.sort)
1189
+
1190
+ set = ary.to_set(SortedSet)
1191
+ assert_instance_of(SortedSet, set)
1192
+ assert_equal([1,2,3,4,5], set.to_a)
1193
+
1194
+ set = ary.to_set(SortedSet) { |o| o * -2 }
1195
+ assert_instance_of(SortedSet, set)
1196
+ assert_equal([-10,-8,-6,-4,-2], set.sort)
1197
+ end
1198
+ end
1199
+
1200
+ # class TC_RestricedSet < Test::Unit::TestCase
1201
+ # def test_s_new
1202
+ # assert_raises(ArgumentError) { RestricedSet.new }
1203
+ #
1204
+ # s = RestricedSet.new([-1,2,3]) { |o| o > 0 }
1205
+ # assert_equal([2,3], s.sort)
1206
+ # end
1207
+ #
1208
+ # def test_restriction_proc
1209
+ # s = RestricedSet.new([-1,2,3]) { |o| o > 0 }
1210
+ #
1211
+ # f = s.restriction_proc
1212
+ # assert_instance_of(Proc, f)
1213
+ # assert(f[1])
1214
+ # assert(!f[0])
1215
+ # end
1216
+ #
1217
+ # def test_replace
1218
+ # s = RestricedSet.new(-3..3) { |o| o > 0 }
1219
+ # assert_equal([1,2,3], s.sort)
1220
+ #
1221
+ # s.replace([-2,0,3,4,5])
1222
+ # assert_equal([3,4,5], s.sort)
1223
+ # end
1224
+ #
1225
+ # def test_merge
1226
+ # s = RestricedSet.new { |o| o > 0 }
1227
+ # s.merge(-5..5)
1228
+ # assert_equal([1,2,3,4,5], s.sort)
1229
+ #
1230
+ # s.merge([10,-10,-8,8])
1231
+ # assert_equal([1,2,3,4,5,8,10], s.sort)
1232
+ # end
1233
+ # end