Permalink
Browse files

Pulled everything I could from master into lib

  • Loading branch information...
Ryan Davis
Ryan Davis committed Sep 10, 2008
1 parent c1aca24 commit 42835258dc9f79b4931be95264491294f2a85d1e
Showing with 44,612 additions and 4,000 deletions.
  1. +103 −0 lib/abbrev.rb
  2. +373 −19 lib/actor.rb
  3. +67 −0 lib/actor/filter.rb
  4. +572 −0 lib/benchmark.rb
  5. +701 −0 lib/bigdecimal.rb
  6. +65 −0 lib/bigdecimal/util.rb
  7. +2 −0 lib/cgi/.document
  8. +484 −0 lib/cgi/session.rb
  9. +111 −0 lib/cgi/session/pstore.rb
  10. +663 −0 lib/complex.rb
  11. +11 −0 lib/core_bridge/README
  12. +2 −0 lib/core_bridge/exception.rb
  13. +35 −0 lib/core_bridge/hashi.rb
  14. +182 −0 lib/core_bridge/tuple.rb
  15. +992 −0 lib/csv.rb
  16. +82 −7 lib/debugger/command.rb
  17. +26 −0 lib/debugger/debug_client.rb
  18. +78 −0 lib/debugger/debug_server.rb
  19. +208 −0 lib/debugger/interface.rb
  20. +242 −53 lib/debugger/output.rb
  21. +416 −166 lib/debugger/standard_commands.rb
  22. +131 −103 lib/debugger/vm_commands.rb
  23. +164 −0 lib/decompiler.rb
  24. +2 −0 lib/drb.rb
  25. +146 −0 lib/drb/acl.rb
  26. +1,782 −0 lib/drb/drb.rb
  27. +16 −0 lib/drb/eq.rb
  28. +71 −0 lib/drb/extserv.rb
  29. +89 −0 lib/drb/extservm.rb
  30. +122 −0 lib/drb/gw.rb
  31. +34 −0 lib/drb/invokemethod.rb
  32. +22 −0 lib/drb/observer.rb
  33. +190 −0 lib/drb/ssl.rb
  34. +91 −0 lib/drb/timeridconv.rb
  35. +108 −0 lib/drb/unix.rb
  36. +276 −276 lib/erb.rb
  37. +145 −0 lib/etc.rb.ffi
  38. +2 −1 lib/ext/readline/build.rb
  39. +29 −8 lib/fcntl.rb
  40. +32 −0 lib/fcntl.rb.ffi
  41. +172 −0 lib/ffi/const_generator.rb
  42. +58 −0 lib/ffi/generator.rb
  43. +35 −0 lib/ffi/generator_task.rb
  44. +190 −0 lib/ffi/struct_generator.rb
  45. +124 −0 lib/ffi/types_generator.rb
  46. +380 −0 lib/generator.rb
  47. +107 −107 lib/getoptlong.rb
  48. +229 −0 lib/iconv.rb
  49. +6 −4 lib/irb/rubinius.rb
  50. +703 −0 lib/logger.rb
  51. +1 −0 lib/md5.rb
  52. +1,556 −0 lib/mkmf.rb
  53. +341 −0 lib/monitor.rb
  54. +99 −0 lib/mutex_m.rb
  55. 0 lib/nkf.rb
  56. +15 −0 lib/openssl.rb
  57. +173 −0 lib/openssl/digest.rb
  58. +173 −0 lib/openssl/digest.rb.ffi
  59. +36 −0 lib/openssl/hmac.rb
  60. +0 −1 lib/pp.rb
  61. +395 −0 lib/pstore.rb
  62. +6 −1 lib/rbyaml.rb
  63. +2 −1 lib/rbyaml/parser.rb
  64. +3 −3 lib/rbyaml/rubytypes.rb
  65. +7 −4 lib/rbyaml/tag.rb
  66. +243 −2 lib/rdoc.rb
  67. +331 −112 lib/rdoc/code_objects.rb
  68. +172 −144 lib/rdoc/generator.rb
  69. +47 −19 lib/rdoc/generator/html.rb
  70. +795 −0 lib/rdoc/generator/html/frameless.rb
  71. +11 −11 lib/rdoc/generator/html/hefss.rb
  72. +81 −87 lib/rdoc/generator/html/html.rb
  73. +10 −10 lib/rdoc/generator/html/kilmer.rb
  74. +9 −9 lib/rdoc/generator/html/one_page_html.rb
  75. +5 −8 lib/rdoc/generator/ri.rb
  76. +84 −0 lib/rdoc/generator/texinfo.rb
  77. +44 −0 lib/rdoc/generator/texinfo/class.texinfo.erb
  78. +6 −0 lib/rdoc/generator/texinfo/file.texinfo.erb
  79. +6 −0 lib/rdoc/generator/texinfo/method.texinfo.erb
  80. +28 −0 lib/rdoc/generator/texinfo/texinfo.erb
  81. +69 −0 lib/rdoc/known_classes.rb
  82. +16 −19 lib/rdoc/markup.rb
  83. +265 −0 lib/rdoc/markup/attribute_manager.rb
  84. +1 −1 lib/rdoc/markup/fragments.rb
  85. +3 −263 lib/rdoc/markup/inline.rb
  86. +10 −6 lib/rdoc/markup/preprocess.rb
  87. +55 −8 lib/rdoc/markup/to_html.rb
  88. +21 −5 lib/rdoc/markup/to_html_crossref.rb
  89. +69 −0 lib/rdoc/markup/to_texinfo.rb
  90. +40 −17 lib/rdoc/options.rb
  91. +109 −0 lib/rdoc/parser.rb
  92. +656 −0 lib/rdoc/parser/c.rb
  93. +1,835 −0 lib/rdoc/parser/f95.rb
  94. +2,829 −0 lib/rdoc/parser/ruby.rb
  95. +38 −0 lib/rdoc/parser/simple.rb
  96. +57 −41 lib/rdoc/rdoc.rb
  97. +5 −1 lib/rdoc/ri.rb
  98. +14 −8 lib/rdoc/ri/descriptions.rb
  99. +134 −104 lib/rdoc/ri/display.rb
  100. +158 −42 lib/rdoc/ri/driver.rb
  101. +16 −3 lib/rdoc/ri/formatter.rb
  102. +1 −1 lib/rdoc/ri/util.rb
  103. +94 −4 lib/rdoc/stats.rb
  104. +4 −4 lib/rdoc/template.rb
  105. +1,884 −0 lib/resolv.rb
  106. +62 −0 lib/rexml/attlistdecl.rb
  107. +185 −0 lib/rexml/attribute.rb
  108. +67 −0 lib/rexml/cdata.rb
  109. +96 −0 lib/rexml/child.rb
  110. +80 −0 lib/rexml/comment.rb
  111. +271 −0 lib/rexml/doctype.rb
  112. +208 −0 lib/rexml/document.rb
  113. +10 −0 lib/rexml/dtd/attlistdecl.rb
  114. +51 −0 lib/rexml/dtd/dtd.rb
  115. +17 −0 lib/rexml/dtd/elementdecl.rb
  116. +56 −0 lib/rexml/dtd/entitydecl.rb
  117. +39 −0 lib/rexml/dtd/notationdecl.rb
  118. +1,227 −0 lib/rexml/element.rb
  119. +71 −0 lib/rexml/encoding.rb
  120. +103 −0 lib/rexml/encodings/CP-1252.rb
  121. +35 −0 lib/rexml/encodings/EUC-JP.rb
  122. +22 −0 lib/rexml/encodings/ICONV.rb
  123. +7 −0 lib/rexml/encodings/ISO-8859-1.rb
  124. +72 −0 lib/rexml/encodings/ISO-8859-15.rb
  125. +37 −0 lib/rexml/encodings/SHIFT-JIS.rb
  126. +1 −0 lib/rexml/encodings/SHIFT_JIS.rb
  127. +34 −0 lib/rexml/encodings/UNILE.rb
  128. +30 −0 lib/rexml/encodings/US-ASCII.rb
  129. +35 −0 lib/rexml/encodings/UTF-16.rb
  130. +18 −0 lib/rexml/encodings/UTF-8.rb
  131. +165 −0 lib/rexml/entity.rb
  132. +109 −0 lib/rexml/formatters/default.rb
  133. +137 −0 lib/rexml/formatters/pretty.rb
  134. +57 −0 lib/rexml/formatters/transitive.rb
  135. +382 −0 lib/rexml/functions.rb
  136. +70 −0 lib/rexml/instruction.rb
  137. +196 −0 lib/rexml/light/node.rb
  138. +47 −0 lib/rexml/namespace.rb
  139. +75 −0 lib/rexml/node.rb
  140. +24 −0 lib/rexml/output.rb
  141. +166 −0 lib/rexml/parent.rb
  142. +51 −0 lib/rexml/parseexception.rb
  143. +503 −0 lib/rexml/parsers/baseparser.rb
  144. +60 −0 lib/rexml/parsers/lightparser.rb
  145. +196 −0 lib/rexml/parsers/pullparser.rb
  146. +238 −0 lib/rexml/parsers/sax2parser.rb
  147. +46 −0 lib/rexml/parsers/streamparser.rb
  148. +97 −0 lib/rexml/parsers/treeparser.rb
  149. +56 −0 lib/rexml/parsers/ultralightparser.rb
  150. +698 −0 lib/rexml/parsers/xpathparser.rb
  151. +266 −0 lib/rexml/quickpath.rb
  152. +32 −0 lib/rexml/rexml.rb
  153. +97 −0 lib/rexml/sax2listener.rb
  154. +251 −0 lib/rexml/source.rb
  155. +92 −0 lib/rexml/streamlistener.rb
  156. +33 −0 lib/rexml/syncenumerator.rb
  157. +344 −0 lib/rexml/text.rb
  158. +8 −0 lib/rexml/undefinednamespaceexception.rb
  159. +559 −0 lib/rexml/validation/relaxng.rb
  160. +155 −0 lib/rexml/validation/validation.rb
  161. +9 −0 lib/rexml/validation/validationexception.rb
  162. +119 −0 lib/rexml/xmldecl.rb
  163. +18 −0 lib/rexml/xmltokens.rb
  164. +66 −0 lib/rexml/xpath.rb
  165. +792 −0 lib/rexml/xpath_parser.rb
  166. +598 −400 lib/rubygems.rb
  167. +1 −1 lib/rubygems/command.rb
  168. +5 −3 lib/rubygems/command_manager.rb
  169. +1 −1 lib/rubygems/commands/cert_command.rb
  170. +49 −18 lib/rubygems/commands/dependency_command.rb
  171. +4 −2 lib/rubygems/commands/environment_command.rb
  172. +3 −1 lib/rubygems/commands/fetch_command.rb
  173. +8 −4 lib/rubygems/commands/install_command.rb
  174. +30 −30 lib/rubygems/commands/list_command.rb
  175. +1 −1 lib/rubygems/commands/lock_command.rb
  176. +5 −2 lib/rubygems/commands/outdated_command.rb
  177. +3 −43 lib/rubygems/commands/pristine_command.rb
  178. +129 −21 lib/rubygems/commands/query_command.rb
  179. +66 −29 lib/rubygems/commands/sources_command.rb
  180. +4 −3 lib/rubygems/commands/specification_command.rb
  181. +27 −0 lib/rubygems/commands/stale_command.rb
  182. +41 −25 lib/rubygems/commands/update_command.rb
  183. +28 −12 lib/rubygems/config_file.rb
  184. +2 −2 lib/rubygems/custom_require.rb
  185. +1 −1 lib/rubygems/defaults.rb
  186. +47 −0 lib/rubygems/defaults/rbx.rb
  187. +63 −9 lib/rubygems/dependency.rb
  188. +85 −28 lib/rubygems/dependency_installer.rb
  189. +1 −1 lib/rubygems/dependency_list.rb
  190. +11 −5 lib/rubygems/doc_manager.rb
  191. +14 −0 lib/rubygems/exceptions.rb
  192. +1 −1 lib/rubygems/format.rb
  193. +1 −1 lib/rubygems/gem_openssl.rb
  194. +273 −76 lib/rubygems/indexer.rb
  195. +6 −0 lib/rubygems/install_update_options.rb
  196. +38 −15 lib/rubygems/installer.rb
  197. +26 −5 lib/rubygems/local_remote_options.rb
  198. +1 −1 lib/rubygems/package/tar_input.rb
  199. +9 −14 lib/rubygems/package/tar_output.rb
  200. +15 −1 lib/rubygems/platform.rb
  201. +140 −83 lib/rubygems/remote_fetcher.rb
  202. +18 −12 lib/rubygems/requirement.rb
  203. +1 −1 lib/rubygems/rubygems_version.rb
  204. +2 −2 lib/rubygems/security.rb
  205. +318 −208 lib/rubygems/server.rb
  206. +426 −317 lib/rubygems/source_index.rb
  207. +254 −102 lib/rubygems/source_info_cache.rb
  208. +14 −4 lib/rubygems/source_info_cache_entry.rb
  209. +251 −0 lib/rubygems/spec_fetcher.rb
  210. +109 −36 lib/rubygems/specification.rb
  211. +120 −0 lib/rubygems/test_utilities.rb
  212. +3 −2 lib/rubygems/uninstaller.rb
  213. +151 −82 lib/rubygems/user_interaction.rb
  214. +3 −3 lib/rubygems/validator.rb
  215. +23 −21 lib/rubygems/version.rb
  216. +1 −2 lib/rubygems/version_option.rb
  217. +60 −0 lib/semaphore.rb
  218. +60 −0 lib/shellwords.rb
  219. +258 −89 lib/socket.rb
  220. +408 −355 lib/stringio.rb
  221. +236 −0 lib/strscan.rb
  222. +296 −0 lib/sync.rb
  223. +44 −42 lib/syslog.rb
  224. +253 −0 lib/syslog.rb.ffi
  225. +86 −72 lib/tempfile.rb
  226. +120 −128 lib/thread.rb
  227. +235 −0 lib/un.rb
  228. +234 −0 lib/vmactor.rb
  229. +29 −0 lib/webrick.rb
  230. +67 −0 lib/webrick/accesslog.rb
  231. +257 −0 lib/webrick/cgi.rb
  232. +15 −0 lib/webrick/compat.rb
  233. +97 −0 lib/webrick/config.rb
  234. +110 −0 lib/webrick/cookie.rb
  235. +25 −0 lib/webrick/htmlutils.rb
  236. +45 −0 lib/webrick/httpauth.rb
  237. +79 −0 lib/webrick/httpauth/authenticator.rb
  238. +65 −0 lib/webrick/httpauth/basicauth.rb
  239. +343 −0 lib/webrick/httpauth/digestauth.rb
  240. +91 −0 lib/webrick/httpauth/htdigest.rb
  241. +61 −0 lib/webrick/httpauth/htgroup.rb
  242. +83 −0 lib/webrick/httpauth/htpasswd.rb
  243. +29 −0 lib/webrick/httpauth/userdb.rb
  244. +254 −0 lib/webrick/httpproxy.rb
  245. +365 −0 lib/webrick/httprequest.rb
  246. +327 −0 lib/webrick/httpresponse.rb
  247. +63 −0 lib/webrick/https.rb
  248. +210 −0 lib/webrick/httpserver.rb
  249. +22 −0 lib/webrick/httpservlet.rb
  250. +71 −0 lib/webrick/httpservlet/abstract.rb
  251. +45 −0 lib/webrick/httpservlet/cgi_runner.rb
  252. +104 −0 lib/webrick/httpservlet/cgihandler.rb
  253. +54 −0 lib/webrick/httpservlet/erbhandler.rb
  254. +398 −0 lib/webrick/httpservlet/filehandler.rb
  255. +33 −0 lib/webrick/httpservlet/prochandler.rb
  256. +126 −0 lib/webrick/httpstatus.rb
  257. +399 −0 lib/webrick/httputils.rb
  258. +49 −0 lib/webrick/httpversion.rb
  259. +88 −0 lib/webrick/log.rb
  260. +200 −0 lib/webrick/server.rb
  261. +126 −0 lib/webrick/ssl.rb
  262. +100 −0 lib/webrick/utils.rb
  263. +13 −0 lib/webrick/version.rb
  264. +1,467 −0 lib/zlib.rb.ffi
View
@@ -0,0 +1,103 @@
+#!/usr/bin/env ruby
+=begin
+#
+# Copyright (c) 2001,2003 Akinori MUSHA <knu@iDaemons.org>
+#
+# All rights reserved. You can redistribute and/or modify it under
+# the same terms as Ruby.
+#
+# $Idaemons: /home/cvs/rb/abbrev.rb,v 1.2 2001/05/30 09:37:45 knu Exp $
+# $RoughId: abbrev.rb,v 1.4 2003/10/14 19:45:42 knu Exp $
+# $Id: abbrev.rb 11708 2007-02-12 23:01:19Z shyouhei $
+=end
+
+# Calculate the set of unique abbreviations for a given set of strings.
+#
+# require 'abbrev'
+# require 'pp'
+#
+# pp Abbrev::abbrev(['ruby', 'rules']).sort
+#
+# <i>Generates:</i>
+#
+# [["rub", "ruby"],
+# ["ruby", "ruby"],
+# ["rul", "rules"],
+# ["rule", "rules"],
+# ["rules", "rules"]]
+#
+# Also adds an +abbrev+ method to class +Array+.
+
+module Abbrev
+
+ # Given a set of strings, calculate the set of unambiguous
+ # abbreviations for those strings, and return a hash where the keys
+ # are all the possible abbreviations and the values are the full
+ # strings. Thus, given input of "car" and "cone", the keys pointing
+ # to "car" would be "ca" and "car", while those pointing to "cone"
+ # would be "co", "con", and "cone".
+ #
+ # The optional +pattern+ parameter is a pattern or a string. Only
+ # those input strings matching the pattern, or begging the string,
+ # are considered for inclusion in the output hash
+
+ def abbrev(words, pattern = nil)
+ table = {}
+ seen = Hash.new(0)
+
+ if pattern.is_a?(String)
+ pattern = /^#{Regexp.quote(pattern)}/ # regard as a prefix
+ end
+
+ words.each do |word|
+ next if (abbrev = word).empty?
+ while (len = abbrev.rindex(/[\w\W]\z/)) > 0
+ abbrev = word[0,len]
+
+ next if pattern && pattern !~ abbrev
+
+ case seen[abbrev] += 1
+ when 1
+ table[abbrev] = word
+ when 2
+ table.delete(abbrev)
+ else
+ break
+ end
+ end
+ end
+
+ words.each do |word|
+ next if pattern && pattern !~ word
+
+ table[word] = word
+ end
+
+ table
+ end
+
+ module_function :abbrev
+end
+
+class Array
+ # Calculates the set of unambiguous abbreviations for the strings in
+ # +self+. If passed a pattern or a string, only the strings matching
+ # the pattern or starting with the string are considered.
+ #
+ # %w{ car cone }.abbrev #=> { "ca" => "car", "car" => "car",
+ # "co" => "cone", "con" => cone",
+ # "cone" => "cone" }
+ def abbrev(pattern = nil)
+ Abbrev::abbrev(self, pattern)
+ end
+end
+
+if $0 == __FILE__
+ while line = gets
+ hash = line.split.abbrev
+
+ hash.sort.each do |k, v|
+ puts "#{k} => #{v}"
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 4283525

Please sign in to comment.