shoesgem 0.1424.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (808) hide show
  1. data/LICENSE +30 -0
  2. data/README.rdoc +31 -0
  3. data/lib/shoes.rb +4 -0
  4. data/shoes/CHANGELOG.txt +21 -0
  5. data/shoes/COPYING.txt +30 -0
  6. data/shoes/README.txt +117 -0
  7. data/shoes/VERSION.txt +1 -0
  8. data/shoes/fonts/Coolvetica.ttf +0 -0
  9. data/shoes/fonts/Lacuna.ttf +0 -0
  10. data/shoes/freetype6.dll +0 -0
  11. data/shoes/lib/shoes/cache.rb +54 -0
  12. data/shoes/lib/shoes/data.rb +39 -0
  13. data/shoes/lib/shoes/help.rb +421 -0
  14. data/shoes/lib/shoes/image.rb +25 -0
  15. data/shoes/lib/shoes/inspect.rb +128 -0
  16. data/shoes/lib/shoes/log.rb +48 -0
  17. data/shoes/lib/shoes/minitar.rb +986 -0
  18. data/shoes/lib/shoes/override.rb +38 -0
  19. data/shoes/lib/shoes/pack.rb +503 -0
  20. data/shoes/lib/shoes/search.rb +46 -0
  21. data/shoes/lib/shoes/setup.rb +329 -0
  22. data/shoes/lib/shoes/shy.rb +131 -0
  23. data/shoes/lib/shoes/shybuilder.rb +44 -0
  24. data/shoes/lib/shoes.rb +522 -0
  25. data/shoes/libcairo-2.dll +0 -0
  26. data/shoes/libeay32.dll +0 -0
  27. data/shoes/libexpat-1.dll +0 -0
  28. data/shoes/libfontconfig-1.dll +0 -0
  29. data/shoes/libgio-2.0-0.dll +0 -0
  30. data/shoes/libglib-2.0-0.dll +0 -0
  31. data/shoes/libgmodule-2.0-0.dll +0 -0
  32. data/shoes/libgobject-2.0-0.dll +0 -0
  33. data/shoes/libgthread-2.0-0.dll +0 -0
  34. data/shoes/libiconv2.dll +0 -0
  35. data/shoes/libjpeg-8.dll +0 -0
  36. data/shoes/libpango-1.0-0.dll +0 -0
  37. data/shoes/libpangocairo-1.0-0.dll +0 -0
  38. data/shoes/libpangoft2-1.0-0.dll +0 -0
  39. data/shoes/libpangowin32-1.0-0.dll +0 -0
  40. data/shoes/libpng14-14.dll +0 -0
  41. data/shoes/libportaudio-2.dll +0 -0
  42. data/shoes/libshoes.dll +0 -0
  43. data/shoes/libssl32.dll +0 -0
  44. data/shoes/libungif4.dll +0 -0
  45. data/shoes/msvcrt-ruby191.dll +0 -0
  46. data/shoes/readline5.dll +0 -0
  47. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/fast_xs.so +0 -0
  48. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/blankslate.rb +63 -0
  49. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/builder.rb +216 -0
  50. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/elements.rb +510 -0
  51. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/htmlinfo.rb +691 -0
  52. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/inspect.rb +103 -0
  53. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/modules.rb +40 -0
  54. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb +38 -0
  55. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tag.rb +202 -0
  56. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tags.rb +164 -0
  57. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/traverse.rb +838 -0
  58. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/xchar.rb +94 -0
  59. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot.rb +26 -0
  60. data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot_scan.so +0 -0
  61. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/core.rb +135 -0
  62. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/rails.rb +58 -0
  63. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/common.rb +354 -0
  64. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/generator.so +0 -0
  65. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/parser.so +0 -0
  66. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext.rb +13 -0
  67. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/version.rb +9 -0
  68. data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json.rb +8 -0
  69. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/constants.rb +49 -0
  70. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/database.rb +721 -0
  71. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/api.rb +152 -0
  72. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/driver.rb +307 -0
  73. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/native/driver.rb +219 -0
  74. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/errors.rb +68 -0
  75. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/pragmas.rb +271 -0
  76. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/resultset.rb +180 -0
  77. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/statement.rb +231 -0
  78. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/translator.rb +109 -0
  79. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/value.rb +57 -0
  80. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/version.rb +16 -0
  81. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3.rb +1 -0
  82. data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3_api.so +0 -0
  83. data/shoes/ruby/gems/1.9.1/specifications/hpricot-0.8.1.gemspec +32 -0
  84. data/shoes/ruby/gems/1.9.1/specifications/json-shoes-1.1.3.gemspec +34 -0
  85. data/shoes/ruby/gems/1.9.1/specifications/sqlite3-ruby-1.2.5-x86-mswin32.gemspec +46 -0
  86. data/shoes/ruby/lib/English.rb +155 -0
  87. data/shoes/ruby/lib/Win32API.rb +28 -0
  88. data/shoes/ruby/lib/abbrev.rb +103 -0
  89. data/shoes/ruby/lib/base64.rb +91 -0
  90. data/shoes/ruby/lib/benchmark.rb +573 -0
  91. data/shoes/ruby/lib/bigdecimal/jacobian.rb +85 -0
  92. data/shoes/ruby/lib/bigdecimal/ludcmp.rb +86 -0
  93. data/shoes/ruby/lib/bigdecimal/math.rb +237 -0
  94. data/shoes/ruby/lib/bigdecimal/newton.rb +77 -0
  95. data/shoes/ruby/lib/bigdecimal/util.rb +53 -0
  96. data/shoes/ruby/lib/cgi/cookie.rb +144 -0
  97. data/shoes/ruby/lib/cgi/core.rb +786 -0
  98. data/shoes/ruby/lib/cgi/html.rb +1021 -0
  99. data/shoes/ruby/lib/cgi/session/pstore.rb +111 -0
  100. data/shoes/ruby/lib/cgi/session.rb +537 -0
  101. data/shoes/ruby/lib/cgi/util.rb +181 -0
  102. data/shoes/ruby/lib/cgi.rb +274 -0
  103. data/shoes/ruby/lib/cmath.rb +233 -0
  104. data/shoes/ruby/lib/complex.rb +24 -0
  105. data/shoes/ruby/lib/csv.rb +2320 -0
  106. data/shoes/ruby/lib/date/format.rb +1313 -0
  107. data/shoes/ruby/lib/date.rb +1834 -0
  108. data/shoes/ruby/lib/debug.rb +907 -0
  109. data/shoes/ruby/lib/delegate.rb +311 -0
  110. data/shoes/ruby/lib/digest/hmac.rb +274 -0
  111. data/shoes/ruby/lib/digest/sha2.rb +74 -0
  112. data/shoes/ruby/lib/digest.rb +50 -0
  113. data/shoes/ruby/lib/dl/callback.rb +69 -0
  114. data/shoes/ruby/lib/dl/cparser.rb +109 -0
  115. data/shoes/ruby/lib/dl/func.rb +153 -0
  116. data/shoes/ruby/lib/dl/import.rb +215 -0
  117. data/shoes/ruby/lib/dl/pack.rb +173 -0
  118. data/shoes/ruby/lib/dl/stack.rb +146 -0
  119. data/shoes/ruby/lib/dl/struct.rb +213 -0
  120. data/shoes/ruby/lib/dl/types.rb +40 -0
  121. data/shoes/ruby/lib/dl/value.rb +112 -0
  122. data/shoes/ruby/lib/drb/acl.rb +146 -0
  123. data/shoes/ruby/lib/drb/drb.rb +1778 -0
  124. data/shoes/ruby/lib/drb/eq.rb +16 -0
  125. data/shoes/ruby/lib/drb/extserv.rb +71 -0
  126. data/shoes/ruby/lib/drb/extservm.rb +85 -0
  127. data/shoes/ruby/lib/drb/gw.rb +122 -0
  128. data/shoes/ruby/lib/drb/invokemethod.rb +34 -0
  129. data/shoes/ruby/lib/drb/observer.rb +22 -0
  130. data/shoes/ruby/lib/drb/ssl.rb +190 -0
  131. data/shoes/ruby/lib/drb/timeridconv.rb +91 -0
  132. data/shoes/ruby/lib/drb/unix.rb +108 -0
  133. data/shoes/ruby/lib/drb.rb +2 -0
  134. data/shoes/ruby/lib/e2mmap.rb +172 -0
  135. data/shoes/ruby/lib/erb.rb +902 -0
  136. data/shoes/ruby/lib/fileutils.rb +1592 -0
  137. data/shoes/ruby/lib/find.rb +81 -0
  138. data/shoes/ruby/lib/forwardable.rb +270 -0
  139. data/shoes/ruby/lib/ftsearch/analysis/analyzer.rb +16 -0
  140. data/shoes/ruby/lib/ftsearch/analysis/simple_identifier_analyzer.rb +23 -0
  141. data/shoes/ruby/lib/ftsearch/analysis/whitespace_analyzer.rb +22 -0
  142. data/shoes/ruby/lib/ftsearch/document_map_reader.rb +106 -0
  143. data/shoes/ruby/lib/ftsearch/document_map_writer.rb +46 -0
  144. data/shoes/ruby/lib/ftsearch/field_infos.rb +46 -0
  145. data/shoes/ruby/lib/ftsearch/fragment_writer.rb +114 -0
  146. data/shoes/ruby/lib/ftsearch/fulltext_reader.rb +52 -0
  147. data/shoes/ruby/lib/ftsearch/fulltext_writer.rb +75 -0
  148. data/shoes/ruby/lib/ftsearch/suffix_array_reader.rb +275 -0
  149. data/shoes/ruby/lib/ftsearch/suffix_array_writer.rb +99 -0
  150. data/shoes/ruby/lib/ftsearch/util.rb +21 -0
  151. data/shoes/ruby/lib/getoptlong.rb +610 -0
  152. data/shoes/ruby/lib/gserver.rb +253 -0
  153. data/shoes/ruby/lib/i386-mingw32/bigdecimal.so +0 -0
  154. data/shoes/ruby/lib/i386-mingw32/binject.so +0 -0
  155. data/shoes/ruby/lib/i386-mingw32/bloops.so +0 -0
  156. data/shoes/ruby/lib/i386-mingw32/continuation.so +0 -0
  157. data/shoes/ruby/lib/i386-mingw32/coverage.so +0 -0
  158. data/shoes/ruby/lib/i386-mingw32/curses.so +0 -0
  159. data/shoes/ruby/lib/i386-mingw32/digest/bubblebabble.so +0 -0
  160. data/shoes/ruby/lib/i386-mingw32/digest/md5.so +0 -0
  161. data/shoes/ruby/lib/i386-mingw32/digest/rmd160.so +0 -0
  162. data/shoes/ruby/lib/i386-mingw32/digest/sha1.so +0 -0
  163. data/shoes/ruby/lib/i386-mingw32/digest/sha2.so +0 -0
  164. data/shoes/ruby/lib/i386-mingw32/digest.so +0 -0
  165. data/shoes/ruby/lib/i386-mingw32/dl.so +0 -0
  166. data/shoes/ruby/lib/i386-mingw32/enc/big5.so +0 -0
  167. data/shoes/ruby/lib/i386-mingw32/enc/cp949.so +0 -0
  168. data/shoes/ruby/lib/i386-mingw32/enc/emacs_mule.so +0 -0
  169. data/shoes/ruby/lib/i386-mingw32/enc/encdb.so +0 -0
  170. data/shoes/ruby/lib/i386-mingw32/enc/euc_jp.so +0 -0
  171. data/shoes/ruby/lib/i386-mingw32/enc/euc_kr.so +0 -0
  172. data/shoes/ruby/lib/i386-mingw32/enc/euc_tw.so +0 -0
  173. data/shoes/ruby/lib/i386-mingw32/enc/gb18030.so +0 -0
  174. data/shoes/ruby/lib/i386-mingw32/enc/gb2312.so +0 -0
  175. data/shoes/ruby/lib/i386-mingw32/enc/gbk.so +0 -0
  176. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_1.so +0 -0
  177. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_10.so +0 -0
  178. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_11.so +0 -0
  179. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_13.so +0 -0
  180. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_14.so +0 -0
  181. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_15.so +0 -0
  182. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_16.so +0 -0
  183. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_2.so +0 -0
  184. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_3.so +0 -0
  185. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_4.so +0 -0
  186. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_5.so +0 -0
  187. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_6.so +0 -0
  188. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_7.so +0 -0
  189. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_8.so +0 -0
  190. data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_9.so +0 -0
  191. data/shoes/ruby/lib/i386-mingw32/enc/koi8_r.so +0 -0
  192. data/shoes/ruby/lib/i386-mingw32/enc/koi8_u.so +0 -0
  193. data/shoes/ruby/lib/i386-mingw32/enc/shift_jis.so +0 -0
  194. data/shoes/ruby/lib/i386-mingw32/enc/trans/big5.so +0 -0
  195. data/shoes/ruby/lib/i386-mingw32/enc/trans/chinese.so +0 -0
  196. data/shoes/ruby/lib/i386-mingw32/enc/trans/escape.so +0 -0
  197. data/shoes/ruby/lib/i386-mingw32/enc/trans/gb18030.so +0 -0
  198. data/shoes/ruby/lib/i386-mingw32/enc/trans/gbk.so +0 -0
  199. data/shoes/ruby/lib/i386-mingw32/enc/trans/iso2022.so +0 -0
  200. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese.so +0 -0
  201. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_euc.so +0 -0
  202. data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_sjis.so +0 -0
  203. data/shoes/ruby/lib/i386-mingw32/enc/trans/korean.so +0 -0
  204. data/shoes/ruby/lib/i386-mingw32/enc/trans/single_byte.so +0 -0
  205. data/shoes/ruby/lib/i386-mingw32/enc/trans/transdb.so +0 -0
  206. data/shoes/ruby/lib/i386-mingw32/enc/trans/utf_16_32.so +0 -0
  207. data/shoes/ruby/lib/i386-mingw32/enc/utf_16be.so +0 -0
  208. data/shoes/ruby/lib/i386-mingw32/enc/utf_16le.so +0 -0
  209. data/shoes/ruby/lib/i386-mingw32/enc/utf_32be.so +0 -0
  210. data/shoes/ruby/lib/i386-mingw32/enc/utf_32le.so +0 -0
  211. data/shoes/ruby/lib/i386-mingw32/enc/windows_1251.so +0 -0
  212. data/shoes/ruby/lib/i386-mingw32/etc.so +0 -0
  213. data/shoes/ruby/lib/i386-mingw32/fcntl.so +0 -0
  214. data/shoes/ruby/lib/i386-mingw32/fiber.so +0 -0
  215. data/shoes/ruby/lib/i386-mingw32/ftsearchrt.so +0 -0
  216. data/shoes/ruby/lib/i386-mingw32/gdbm.so +0 -0
  217. data/shoes/ruby/lib/i386-mingw32/iconv.so +0 -0
  218. data/shoes/ruby/lib/i386-mingw32/io/wait.so +0 -0
  219. data/shoes/ruby/lib/i386-mingw32/json/ext/generator.so +0 -0
  220. data/shoes/ruby/lib/i386-mingw32/json/ext/parser.so +0 -0
  221. data/shoes/ruby/lib/i386-mingw32/mathn/complex.so +0 -0
  222. data/shoes/ruby/lib/i386-mingw32/mathn/rational.so +0 -0
  223. data/shoes/ruby/lib/i386-mingw32/nkf.so +0 -0
  224. data/shoes/ruby/lib/i386-mingw32/openssl.so +0 -0
  225. data/shoes/ruby/lib/i386-mingw32/racc/cparse.so +0 -0
  226. data/shoes/ruby/lib/i386-mingw32/rbconfig.rb +196 -0
  227. data/shoes/ruby/lib/i386-mingw32/readline.so +0 -0
  228. data/shoes/ruby/lib/i386-mingw32/ripper.so +0 -0
  229. data/shoes/ruby/lib/i386-mingw32/sdbm.so +0 -0
  230. data/shoes/ruby/lib/i386-mingw32/socket.so +0 -0
  231. data/shoes/ruby/lib/i386-mingw32/stringio.so +0 -0
  232. data/shoes/ruby/lib/i386-mingw32/strscan.so +0 -0
  233. data/shoes/ruby/lib/i386-mingw32/syck.so +0 -0
  234. data/shoes/ruby/lib/i386-mingw32/win32ole.so +0 -0
  235. data/shoes/ruby/lib/i386-mingw32/zlib.so +0 -0
  236. data/shoes/ruby/lib/io/nonblock.rb +23 -0
  237. data/shoes/ruby/lib/ipaddr.rb +813 -0
  238. data/shoes/ruby/lib/irb/cmd/chws.rb +32 -0
  239. data/shoes/ruby/lib/irb/cmd/fork.rb +38 -0
  240. data/shoes/ruby/lib/irb/cmd/help.rb +36 -0
  241. data/shoes/ruby/lib/irb/cmd/load.rb +66 -0
  242. data/shoes/ruby/lib/irb/cmd/nop.rb +38 -0
  243. data/shoes/ruby/lib/irb/cmd/pushws.rb +38 -0
  244. data/shoes/ruby/lib/irb/cmd/subirb.rb +42 -0
  245. data/shoes/ruby/lib/irb/completion.rb +207 -0
  246. data/shoes/ruby/lib/irb/context.rb +255 -0
  247. data/shoes/ruby/lib/irb/ext/change-ws.rb +61 -0
  248. data/shoes/ruby/lib/irb/ext/history.rb +109 -0
  249. data/shoes/ruby/lib/irb/ext/loader.rb +119 -0
  250. data/shoes/ruby/lib/irb/ext/math-mode.rb +36 -0
  251. data/shoes/ruby/lib/irb/ext/multi-irb.rb +240 -0
  252. data/shoes/ruby/lib/irb/ext/save-history.rb +100 -0
  253. data/shoes/ruby/lib/irb/ext/tracer.rb +60 -0
  254. data/shoes/ruby/lib/irb/ext/use-loader.rb +64 -0
  255. data/shoes/ruby/lib/irb/ext/workspaces.rb +55 -0
  256. data/shoes/ruby/lib/irb/extend-command.rb +272 -0
  257. data/shoes/ruby/lib/irb/frame.rb +66 -0
  258. data/shoes/ruby/lib/irb/help.rb +35 -0
  259. data/shoes/ruby/lib/irb/init.rb +288 -0
  260. data/shoes/ruby/lib/irb/input-method.rb +142 -0
  261. data/shoes/ruby/lib/irb/lc/error.rb +29 -0
  262. data/shoes/ruby/lib/irb/lc/help-message +38 -0
  263. data/shoes/ruby/lib/irb/lc/ja/encoding_aliases.rb +8 -0
  264. data/shoes/ruby/lib/irb/lc/ja/error.rb +27 -0
  265. data/shoes/ruby/lib/irb/lc/ja/help-message +39 -0
  266. data/shoes/ruby/lib/irb/locale.rb +195 -0
  267. data/shoes/ruby/lib/irb/magic-file.rb +36 -0
  268. data/shoes/ruby/lib/irb/notifier.rb +144 -0
  269. data/shoes/ruby/lib/irb/output-method.rb +69 -0
  270. data/shoes/ruby/lib/irb/ruby-lex.rb +1188 -0
  271. data/shoes/ruby/lib/irb/ruby-token.rb +270 -0
  272. data/shoes/ruby/lib/irb/slex.rb +282 -0
  273. data/shoes/ruby/lib/irb/src_encoding.rb +4 -0
  274. data/shoes/ruby/lib/irb/version.rb +15 -0
  275. data/shoes/ruby/lib/irb/workspace.rb +108 -0
  276. data/shoes/ruby/lib/irb/ws-for-case-2.rb +14 -0
  277. data/shoes/ruby/lib/irb/xmp.rb +97 -0
  278. data/shoes/ruby/lib/irb.rb +354 -0
  279. data/shoes/ruby/lib/json/add/core.rb +135 -0
  280. data/shoes/ruby/lib/json/add/rails.rb +58 -0
  281. data/shoes/ruby/lib/json/common.rb +354 -0
  282. data/shoes/ruby/lib/json/editor.rb +1371 -0
  283. data/shoes/ruby/lib/json/ext.rb +15 -0
  284. data/shoes/ruby/lib/json/version.rb +9 -0
  285. data/shoes/ruby/lib/json.rb +297 -0
  286. data/shoes/ruby/lib/kconv.rb +282 -0
  287. data/shoes/ruby/lib/logger.rb +732 -0
  288. data/shoes/ruby/lib/mathn.rb +206 -0
  289. data/shoes/ruby/lib/matrix.rb +1381 -0
  290. data/shoes/ruby/lib/minitest/autorun.rb +9 -0
  291. data/shoes/ruby/lib/minitest/mock.rb +37 -0
  292. data/shoes/ruby/lib/minitest/spec.rb +89 -0
  293. data/shoes/ruby/lib/minitest/unit.rb +497 -0
  294. data/shoes/ruby/lib/mkmf.rb +1958 -0
  295. data/shoes/ruby/lib/monitor.rb +265 -0
  296. data/shoes/ruby/lib/mutex_m.rb +91 -0
  297. data/shoes/ruby/lib/net/ftp.rb +981 -0
  298. data/shoes/ruby/lib/net/http.rb +2399 -0
  299. data/shoes/ruby/lib/net/https.rb +136 -0
  300. data/shoes/ruby/lib/net/imap.rb +3500 -0
  301. data/shoes/ruby/lib/net/pop.rb +1000 -0
  302. data/shoes/ruby/lib/net/protocol.rb +382 -0
  303. data/shoes/ruby/lib/net/smtp.rb +1014 -0
  304. data/shoes/ruby/lib/net/telnet.rb +759 -0
  305. data/shoes/ruby/lib/observer.rb +193 -0
  306. data/shoes/ruby/lib/open-uri.rb +832 -0
  307. data/shoes/ruby/lib/open3.rb +98 -0
  308. data/shoes/ruby/lib/openssl/bn.rb +35 -0
  309. data/shoes/ruby/lib/openssl/buffering.rb +242 -0
  310. data/shoes/ruby/lib/openssl/cipher.rb +65 -0
  311. data/shoes/ruby/lib/openssl/digest.rb +61 -0
  312. data/shoes/ruby/lib/openssl/ssl.rb +178 -0
  313. data/shoes/ruby/lib/openssl/x509.rb +155 -0
  314. data/shoes/ruby/lib/openssl.rb +24 -0
  315. data/shoes/ruby/lib/optparse/date.rb +17 -0
  316. data/shoes/ruby/lib/optparse/shellwords.rb +6 -0
  317. data/shoes/ruby/lib/optparse/time.rb +10 -0
  318. data/shoes/ruby/lib/optparse/uri.rb +6 -0
  319. data/shoes/ruby/lib/optparse/version.rb +70 -0
  320. data/shoes/ruby/lib/optparse.rb +1810 -0
  321. data/shoes/ruby/lib/ostruct.rb +145 -0
  322. data/shoes/ruby/lib/pathname.rb +1099 -0
  323. data/shoes/ruby/lib/pp.rb +532 -0
  324. data/shoes/ruby/lib/prettyprint.rb +896 -0
  325. data/shoes/ruby/lib/prime.rb +471 -0
  326. data/shoes/ruby/lib/profile.rb +10 -0
  327. data/shoes/ruby/lib/profiler.rb +59 -0
  328. data/shoes/ruby/lib/pstore.rb +543 -0
  329. data/shoes/ruby/lib/racc/parser.rb +441 -0
  330. data/shoes/ruby/lib/rake/classic_namespace.rb +8 -0
  331. data/shoes/ruby/lib/rake/clean.rb +33 -0
  332. data/shoes/ruby/lib/rake/gempackagetask.rb +97 -0
  333. data/shoes/ruby/lib/rake/loaders/makefile.rb +35 -0
  334. data/shoes/ruby/lib/rake/packagetask.rb +185 -0
  335. data/shoes/ruby/lib/rake/rake_test_loader.rb +5 -0
  336. data/shoes/ruby/lib/rake/rdoctask.rb +147 -0
  337. data/shoes/ruby/lib/rake/runtest.rb +23 -0
  338. data/shoes/ruby/lib/rake/tasklib.rb +23 -0
  339. data/shoes/ruby/lib/rake/testtask.rb +161 -0
  340. data/shoes/ruby/lib/rake/win32.rb +34 -0
  341. data/shoes/ruby/lib/rake.rb +2465 -0
  342. data/shoes/ruby/lib/rational.rb +19 -0
  343. data/shoes/ruby/lib/rbconfig/datadir.rb +24 -0
  344. data/shoes/ruby/lib/rdoc/code_objects.rb +1061 -0
  345. data/shoes/ruby/lib/rdoc/diagram.rb +340 -0
  346. data/shoes/ruby/lib/rdoc/dot.rb +249 -0
  347. data/shoes/ruby/lib/rdoc/generator/chm/chm.rb +100 -0
  348. data/shoes/ruby/lib/rdoc/generator/chm.rb +113 -0
  349. data/shoes/ruby/lib/rdoc/generator/html/common.rb +24 -0
  350. data/shoes/ruby/lib/rdoc/generator/html/frameless.rb +92 -0
  351. data/shoes/ruby/lib/rdoc/generator/html/hefss.rb +150 -0
  352. data/shoes/ruby/lib/rdoc/generator/html/html.rb +769 -0
  353. data/shoes/ruby/lib/rdoc/generator/html/kilmer.rb +151 -0
  354. data/shoes/ruby/lib/rdoc/generator/html/kilmerfactory.rb +427 -0
  355. data/shoes/ruby/lib/rdoc/generator/html/one_page_html.rb +122 -0
  356. data/shoes/ruby/lib/rdoc/generator/html.rb +445 -0
  357. data/shoes/ruby/lib/rdoc/generator/ri.rb +226 -0
  358. data/shoes/ruby/lib/rdoc/generator/texinfo/class.texinfo.erb +44 -0
  359. data/shoes/ruby/lib/rdoc/generator/texinfo/file.texinfo.erb +6 -0
  360. data/shoes/ruby/lib/rdoc/generator/texinfo/method.texinfo.erb +6 -0
  361. data/shoes/ruby/lib/rdoc/generator/texinfo/texinfo.erb +28 -0
  362. data/shoes/ruby/lib/rdoc/generator/texinfo.rb +81 -0
  363. data/shoes/ruby/lib/rdoc/generator/xml/rdf.rb +113 -0
  364. data/shoes/ruby/lib/rdoc/generator/xml/xml.rb +123 -0
  365. data/shoes/ruby/lib/rdoc/generator/xml.rb +117 -0
  366. data/shoes/ruby/lib/rdoc/generator.rb +1082 -0
  367. data/shoes/ruby/lib/rdoc/known_classes.rb +68 -0
  368. data/shoes/ruby/lib/rdoc/markup/attribute_manager.rb +265 -0
  369. data/shoes/ruby/lib/rdoc/markup/formatter.rb +14 -0
  370. data/shoes/ruby/lib/rdoc/markup/fragments.rb +337 -0
  371. data/shoes/ruby/lib/rdoc/markup/inline.rb +101 -0
  372. data/shoes/ruby/lib/rdoc/markup/lines.rb +152 -0
  373. data/shoes/ruby/lib/rdoc/markup/preprocess.rb +75 -0
  374. data/shoes/ruby/lib/rdoc/markup/to_flow.rb +185 -0
  375. data/shoes/ruby/lib/rdoc/markup/to_html.rb +403 -0
  376. data/shoes/ruby/lib/rdoc/markup/to_html_crossref.rb +148 -0
  377. data/shoes/ruby/lib/rdoc/markup/to_latex.rb +328 -0
  378. data/shoes/ruby/lib/rdoc/markup/to_test.rb +50 -0
  379. data/shoes/ruby/lib/rdoc/markup/to_texinfo.rb +69 -0
  380. data/shoes/ruby/lib/rdoc/markup.rb +378 -0
  381. data/shoes/ruby/lib/rdoc/options.rb +638 -0
  382. data/shoes/ruby/lib/rdoc/parser/c.rb +661 -0
  383. data/shoes/ruby/lib/rdoc/parser/f95.rb +1835 -0
  384. data/shoes/ruby/lib/rdoc/parser/perl.rb +165 -0
  385. data/shoes/ruby/lib/rdoc/parser/ruby.rb +2829 -0
  386. data/shoes/ruby/lib/rdoc/parser/simple.rb +38 -0
  387. data/shoes/ruby/lib/rdoc/parser.rb +142 -0
  388. data/shoes/ruby/lib/rdoc/rdoc.rb +293 -0
  389. data/shoes/ruby/lib/rdoc/ri/cache.rb +187 -0
  390. data/shoes/ruby/lib/rdoc/ri/descriptions.rb +156 -0
  391. data/shoes/ruby/lib/rdoc/ri/display.rb +392 -0
  392. data/shoes/ruby/lib/rdoc/ri/driver.rb +669 -0
  393. data/shoes/ruby/lib/rdoc/ri/formatter.rb +616 -0
  394. data/shoes/ruby/lib/rdoc/ri/paths.rb +99 -0
  395. data/shoes/ruby/lib/rdoc/ri/reader.rb +106 -0
  396. data/shoes/ruby/lib/rdoc/ri/util.rb +79 -0
  397. data/shoes/ruby/lib/rdoc/ri/writer.rb +68 -0
  398. data/shoes/ruby/lib/rdoc/ri.rb +8 -0
  399. data/shoes/ruby/lib/rdoc/stats.rb +115 -0
  400. data/shoes/ruby/lib/rdoc/template.rb +64 -0
  401. data/shoes/ruby/lib/rdoc/tokenstream.rb +33 -0
  402. data/shoes/ruby/lib/rdoc.rb +395 -0
  403. data/shoes/ruby/lib/resolv-replace.rb +63 -0
  404. data/shoes/ruby/lib/resolv.rb +2262 -0
  405. data/shoes/ruby/lib/rexml/attlistdecl.rb +62 -0
  406. data/shoes/ruby/lib/rexml/attribute.rb +188 -0
  407. data/shoes/ruby/lib/rexml/cdata.rb +67 -0
  408. data/shoes/ruby/lib/rexml/child.rb +96 -0
  409. data/shoes/ruby/lib/rexml/comment.rb +80 -0
  410. data/shoes/ruby/lib/rexml/doctype.rb +270 -0
  411. data/shoes/ruby/lib/rexml/document.rb +231 -0
  412. data/shoes/ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
  413. data/shoes/ruby/lib/rexml/dtd/dtd.rb +51 -0
  414. data/shoes/ruby/lib/rexml/dtd/elementdecl.rb +17 -0
  415. data/shoes/ruby/lib/rexml/dtd/entitydecl.rb +56 -0
  416. data/shoes/ruby/lib/rexml/dtd/notationdecl.rb +39 -0
  417. data/shoes/ruby/lib/rexml/element.rb +1246 -0
  418. data/shoes/ruby/lib/rexml/encoding.rb +71 -0
  419. data/shoes/ruby/lib/rexml/encodings/CP-1252.rb +103 -0
  420. data/shoes/ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
  421. data/shoes/ruby/lib/rexml/encodings/ICONV.rb +22 -0
  422. data/shoes/ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
  423. data/shoes/ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
  424. data/shoes/ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
  425. data/shoes/ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
  426. data/shoes/ruby/lib/rexml/encodings/UNILE.rb +34 -0
  427. data/shoes/ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
  428. data/shoes/ruby/lib/rexml/encodings/UTF-16.rb +35 -0
  429. data/shoes/ruby/lib/rexml/encodings/UTF-8.rb +18 -0
  430. data/shoes/ruby/lib/rexml/entity.rb +166 -0
  431. data/shoes/ruby/lib/rexml/formatters/default.rb +109 -0
  432. data/shoes/ruby/lib/rexml/formatters/pretty.rb +139 -0
  433. data/shoes/ruby/lib/rexml/formatters/transitive.rb +58 -0
  434. data/shoes/ruby/lib/rexml/functions.rb +388 -0
  435. data/shoes/ruby/lib/rexml/instruction.rb +70 -0
  436. data/shoes/ruby/lib/rexml/light/node.rb +196 -0
  437. data/shoes/ruby/lib/rexml/namespace.rb +47 -0
  438. data/shoes/ruby/lib/rexml/node.rb +75 -0
  439. data/shoes/ruby/lib/rexml/output.rb +24 -0
  440. data/shoes/ruby/lib/rexml/parent.rb +166 -0
  441. data/shoes/ruby/lib/rexml/parseexception.rb +51 -0
  442. data/shoes/ruby/lib/rexml/parsers/baseparser.rb +530 -0
  443. data/shoes/ruby/lib/rexml/parsers/lightparser.rb +58 -0
  444. data/shoes/ruby/lib/rexml/parsers/pullparser.rb +196 -0
  445. data/shoes/ruby/lib/rexml/parsers/sax2parser.rb +247 -0
  446. data/shoes/ruby/lib/rexml/parsers/streamparser.rb +46 -0
  447. data/shoes/ruby/lib/rexml/parsers/treeparser.rb +100 -0
  448. data/shoes/ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
  449. data/shoes/ruby/lib/rexml/parsers/xpathparser.rb +698 -0
  450. data/shoes/ruby/lib/rexml/quickpath.rb +263 -0
  451. data/shoes/ruby/lib/rexml/rexml.rb +31 -0
  452. data/shoes/ruby/lib/rexml/sax2listener.rb +97 -0
  453. data/shoes/ruby/lib/rexml/source.rb +258 -0
  454. data/shoes/ruby/lib/rexml/streamlistener.rb +92 -0
  455. data/shoes/ruby/lib/rexml/syncenumerator.rb +32 -0
  456. data/shoes/ruby/lib/rexml/text.rb +404 -0
  457. data/shoes/ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
  458. data/shoes/ruby/lib/rexml/validation/relaxng.rb +559 -0
  459. data/shoes/ruby/lib/rexml/validation/validation.rb +155 -0
  460. data/shoes/ruby/lib/rexml/validation/validationexception.rb +9 -0
  461. data/shoes/ruby/lib/rexml/xmldecl.rb +119 -0
  462. data/shoes/ruby/lib/rexml/xmltokens.rb +18 -0
  463. data/shoes/ruby/lib/rexml/xpath.rb +77 -0
  464. data/shoes/ruby/lib/rexml/xpath_parser.rb +792 -0
  465. data/shoes/ruby/lib/rinda/rinda.rb +283 -0
  466. data/shoes/ruby/lib/rinda/ring.rb +271 -0
  467. data/shoes/ruby/lib/rinda/tuplespace.rb +642 -0
  468. data/shoes/ruby/lib/ripper/core.rb +70 -0
  469. data/shoes/ruby/lib/ripper/filter.rb +70 -0
  470. data/shoes/ruby/lib/ripper/lexer.rb +179 -0
  471. data/shoes/ruby/lib/ripper/sexp.rb +99 -0
  472. data/shoes/ruby/lib/ripper.rb +4 -0
  473. data/shoes/ruby/lib/rss/0.9.rb +427 -0
  474. data/shoes/ruby/lib/rss/1.0.rb +452 -0
  475. data/shoes/ruby/lib/rss/2.0.rb +111 -0
  476. data/shoes/ruby/lib/rss/atom.rb +748 -0
  477. data/shoes/ruby/lib/rss/content/1.0.rb +10 -0
  478. data/shoes/ruby/lib/rss/content/2.0.rb +12 -0
  479. data/shoes/ruby/lib/rss/content.rb +31 -0
  480. data/shoes/ruby/lib/rss/converter.rb +170 -0
  481. data/shoes/ruby/lib/rss/dublincore/1.0.rb +13 -0
  482. data/shoes/ruby/lib/rss/dublincore/2.0.rb +13 -0
  483. data/shoes/ruby/lib/rss/dublincore/atom.rb +17 -0
  484. data/shoes/ruby/lib/rss/dublincore.rb +161 -0
  485. data/shoes/ruby/lib/rss/image.rb +193 -0
  486. data/shoes/ruby/lib/rss/itunes.rb +410 -0
  487. data/shoes/ruby/lib/rss/maker/0.9.rb +467 -0
  488. data/shoes/ruby/lib/rss/maker/1.0.rb +434 -0
  489. data/shoes/ruby/lib/rss/maker/2.0.rb +223 -0
  490. data/shoes/ruby/lib/rss/maker/atom.rb +172 -0
  491. data/shoes/ruby/lib/rss/maker/base.rb +880 -0
  492. data/shoes/ruby/lib/rss/maker/content.rb +21 -0
  493. data/shoes/ruby/lib/rss/maker/dublincore.rb +124 -0
  494. data/shoes/ruby/lib/rss/maker/entry.rb +163 -0
  495. data/shoes/ruby/lib/rss/maker/feed.rb +430 -0
  496. data/shoes/ruby/lib/rss/maker/image.rb +111 -0
  497. data/shoes/ruby/lib/rss/maker/itunes.rb +242 -0
  498. data/shoes/ruby/lib/rss/maker/slash.rb +33 -0
  499. data/shoes/ruby/lib/rss/maker/syndication.rb +18 -0
  500. data/shoes/ruby/lib/rss/maker/taxonomy.rb +118 -0
  501. data/shoes/ruby/lib/rss/maker/trackback.rb +61 -0
  502. data/shoes/ruby/lib/rss/maker.rb +44 -0
  503. data/shoes/ruby/lib/rss/parser.rb +568 -0
  504. data/shoes/ruby/lib/rss/rexmlparser.rb +54 -0
  505. data/shoes/ruby/lib/rss/rss.rb +1313 -0
  506. data/shoes/ruby/lib/rss/slash.rb +49 -0
  507. data/shoes/ruby/lib/rss/syndication.rb +67 -0
  508. data/shoes/ruby/lib/rss/taxonomy.rb +145 -0
  509. data/shoes/ruby/lib/rss/trackback.rb +288 -0
  510. data/shoes/ruby/lib/rss/utils.rb +111 -0
  511. data/shoes/ruby/lib/rss/xml-stylesheet.rb +105 -0
  512. data/shoes/ruby/lib/rss/xml.rb +71 -0
  513. data/shoes/ruby/lib/rss/xmlparser.rb +93 -0
  514. data/shoes/ruby/lib/rss/xmlscanner.rb +121 -0
  515. data/shoes/ruby/lib/rss.rb +19 -0
  516. data/shoes/ruby/lib/rubygems/builder.rb +88 -0
  517. data/shoes/ruby/lib/rubygems/command.rb +406 -0
  518. data/shoes/ruby/lib/rubygems/command_manager.rb +146 -0
  519. data/shoes/ruby/lib/rubygems/commands/build_command.rb +53 -0
  520. data/shoes/ruby/lib/rubygems/commands/cert_command.rb +86 -0
  521. data/shoes/ruby/lib/rubygems/commands/check_command.rb +75 -0
  522. data/shoes/ruby/lib/rubygems/commands/cleanup_command.rb +91 -0
  523. data/shoes/ruby/lib/rubygems/commands/contents_command.rb +74 -0
  524. data/shoes/ruby/lib/rubygems/commands/dependency_command.rb +188 -0
  525. data/shoes/ruby/lib/rubygems/commands/environment_command.rb +128 -0
  526. data/shoes/ruby/lib/rubygems/commands/fetch_command.rb +62 -0
  527. data/shoes/ruby/lib/rubygems/commands/generate_index_command.rb +57 -0
  528. data/shoes/ruby/lib/rubygems/commands/help_command.rb +172 -0
  529. data/shoes/ruby/lib/rubygems/commands/install_command.rb +148 -0
  530. data/shoes/ruby/lib/rubygems/commands/list_command.rb +35 -0
  531. data/shoes/ruby/lib/rubygems/commands/lock_command.rb +110 -0
  532. data/shoes/ruby/lib/rubygems/commands/mirror_command.rb +111 -0
  533. data/shoes/ruby/lib/rubygems/commands/outdated_command.rb +33 -0
  534. data/shoes/ruby/lib/rubygems/commands/pristine_command.rb +93 -0
  535. data/shoes/ruby/lib/rubygems/commands/query_command.rb +233 -0
  536. data/shoes/ruby/lib/rubygems/commands/rdoc_command.rb +82 -0
  537. data/shoes/ruby/lib/rubygems/commands/search_command.rb +37 -0
  538. data/shoes/ruby/lib/rubygems/commands/server_command.rb +48 -0
  539. data/shoes/ruby/lib/rubygems/commands/sources_command.rb +152 -0
  540. data/shoes/ruby/lib/rubygems/commands/specification_command.rb +77 -0
  541. data/shoes/ruby/lib/rubygems/commands/stale_command.rb +27 -0
  542. data/shoes/ruby/lib/rubygems/commands/uninstall_command.rb +73 -0
  543. data/shoes/ruby/lib/rubygems/commands/unpack_command.rb +95 -0
  544. data/shoes/ruby/lib/rubygems/commands/update_command.rb +181 -0
  545. data/shoes/ruby/lib/rubygems/commands/which_command.rb +87 -0
  546. data/shoes/ruby/lib/rubygems/config_file.rb +266 -0
  547. data/shoes/ruby/lib/rubygems/custom_require.rb +46 -0
  548. data/shoes/ruby/lib/rubygems/defaults.rb +89 -0
  549. data/shoes/ruby/lib/rubygems/dependency.rb +119 -0
  550. data/shoes/ruby/lib/rubygems/dependency_installer.rb +258 -0
  551. data/shoes/ruby/lib/rubygems/dependency_list.rb +165 -0
  552. data/shoes/ruby/lib/rubygems/digest/digest_adapter.rb +40 -0
  553. data/shoes/ruby/lib/rubygems/digest/md5.rb +23 -0
  554. data/shoes/ruby/lib/rubygems/digest/sha1.rb +17 -0
  555. data/shoes/ruby/lib/rubygems/digest/sha2.rb +17 -0
  556. data/shoes/ruby/lib/rubygems/doc_manager.rb +214 -0
  557. data/shoes/ruby/lib/rubygems/exceptions.rb +84 -0
  558. data/shoes/ruby/lib/rubygems/ext/builder.rb +56 -0
  559. data/shoes/ruby/lib/rubygems/ext/configure_builder.rb +24 -0
  560. data/shoes/ruby/lib/rubygems/ext/ext_conf_builder.rb +23 -0
  561. data/shoes/ruby/lib/rubygems/ext/rake_builder.rb +27 -0
  562. data/shoes/ruby/lib/rubygems/ext.rb +18 -0
  563. data/shoes/ruby/lib/rubygems/format.rb +87 -0
  564. data/shoes/ruby/lib/rubygems/gem_openssl.rb +83 -0
  565. data/shoes/ruby/lib/rubygems/gem_path_searcher.rb +100 -0
  566. data/shoes/ruby/lib/rubygems/gem_runner.rb +58 -0
  567. data/shoes/ruby/lib/rubygems/indexer/abstract_index_builder.rb +88 -0
  568. data/shoes/ruby/lib/rubygems/indexer/latest_index_builder.rb +35 -0
  569. data/shoes/ruby/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
  570. data/shoes/ruby/lib/rubygems/indexer/master_index_builder.rb +54 -0
  571. data/shoes/ruby/lib/rubygems/indexer/quick_index_builder.rb +50 -0
  572. data/shoes/ruby/lib/rubygems/indexer.rb +370 -0
  573. data/shoes/ruby/lib/rubygems/install_update_options.rb +113 -0
  574. data/shoes/ruby/lib/rubygems/installer.rb +578 -0
  575. data/shoes/ruby/lib/rubygems/local_remote_options.rb +134 -0
  576. data/shoes/ruby/lib/rubygems/old_format.rb +148 -0
  577. data/shoes/ruby/lib/rubygems/package/f_sync_dir.rb +24 -0
  578. data/shoes/ruby/lib/rubygems/package/tar_header.rb +245 -0
  579. data/shoes/ruby/lib/rubygems/package/tar_input.rb +219 -0
  580. data/shoes/ruby/lib/rubygems/package/tar_output.rb +143 -0
  581. data/shoes/ruby/lib/rubygems/package/tar_reader/entry.rb +99 -0
  582. data/shoes/ruby/lib/rubygems/package/tar_reader.rb +86 -0
  583. data/shoes/ruby/lib/rubygems/package/tar_writer.rb +180 -0
  584. data/shoes/ruby/lib/rubygems/package.rb +95 -0
  585. data/shoes/ruby/lib/rubygems/platform.rb +178 -0
  586. data/shoes/ruby/lib/rubygems/remote_fetcher.rb +344 -0
  587. data/shoes/ruby/lib/rubygems/require_paths_builder.rb +15 -0
  588. data/shoes/ruby/lib/rubygems/requirement.rb +163 -0
  589. data/shoes/ruby/lib/rubygems/rubygems_version.rb +6 -0
  590. data/shoes/ruby/lib/rubygems/security.rb +786 -0
  591. data/shoes/ruby/lib/rubygems/server.rb +629 -0
  592. data/shoes/ruby/lib/rubygems/source_index.rb +559 -0
  593. data/shoes/ruby/lib/rubygems/source_info_cache.rb +393 -0
  594. data/shoes/ruby/lib/rubygems/source_info_cache_entry.rb +56 -0
  595. data/shoes/ruby/lib/rubygems/spec_fetcher.rb +249 -0
  596. data/shoes/ruby/lib/rubygems/specification.rb +1262 -0
  597. data/shoes/ruby/lib/rubygems/test_utilities.rb +131 -0
  598. data/shoes/ruby/lib/rubygems/timer.rb +25 -0
  599. data/shoes/ruby/lib/rubygems/uninstaller.rb +242 -0
  600. data/shoes/ruby/lib/rubygems/user_interaction.rb +360 -0
  601. data/shoes/ruby/lib/rubygems/validator.rb +208 -0
  602. data/shoes/ruby/lib/rubygems/version.rb +167 -0
  603. data/shoes/ruby/lib/rubygems/version_option.rb +48 -0
  604. data/shoes/ruby/lib/rubygems.rb +888 -0
  605. data/shoes/ruby/lib/scanf.rb +703 -0
  606. data/shoes/ruby/lib/securerandom.rb +182 -0
  607. data/shoes/ruby/lib/set.rb +1274 -0
  608. data/shoes/ruby/lib/shell/builtin-command.rb +160 -0
  609. data/shoes/ruby/lib/shell/command-processor.rb +593 -0
  610. data/shoes/ruby/lib/shell/error.rb +25 -0
  611. data/shoes/ruby/lib/shell/filter.rb +109 -0
  612. data/shoes/ruby/lib/shell/process-controller.rb +319 -0
  613. data/shoes/ruby/lib/shell/system-command.rb +159 -0
  614. data/shoes/ruby/lib/shell/version.rb +15 -0
  615. data/shoes/ruby/lib/shell.rb +300 -0
  616. data/shoes/ruby/lib/shellwords.rb +156 -0
  617. data/shoes/ruby/lib/singleton.rb +313 -0
  618. data/shoes/ruby/lib/sync.rb +307 -0
  619. data/shoes/ruby/lib/tempfile.rb +218 -0
  620. data/shoes/ruby/lib/test/unit/assertions.rb +122 -0
  621. data/shoes/ruby/lib/test/unit/testcase.rb +12 -0
  622. data/shoes/ruby/lib/test/unit.rb +66 -0
  623. data/shoes/ruby/lib/thread.rb +367 -0
  624. data/shoes/ruby/lib/thwait.rb +168 -0
  625. data/shoes/ruby/lib/time.rb +869 -0
  626. data/shoes/ruby/lib/timeout.rb +108 -0
  627. data/shoes/ruby/lib/tmpdir.rb +138 -0
  628. data/shoes/ruby/lib/tracer.rb +166 -0
  629. data/shoes/ruby/lib/tsort.rb +290 -0
  630. data/shoes/ruby/lib/ubygems.rb +10 -0
  631. data/shoes/ruby/lib/un.rb +304 -0
  632. data/shoes/ruby/lib/uri/common.rb +727 -0
  633. data/shoes/ruby/lib/uri/ftp.rb +198 -0
  634. data/shoes/ruby/lib/uri/generic.rb +1128 -0
  635. data/shoes/ruby/lib/uri/http.rb +100 -0
  636. data/shoes/ruby/lib/uri/https.rb +20 -0
  637. data/shoes/ruby/lib/uri/ldap.rb +190 -0
  638. data/shoes/ruby/lib/uri/ldaps.rb +12 -0
  639. data/shoes/ruby/lib/uri/mailto.rb +266 -0
  640. data/shoes/ruby/lib/uri.rb +29 -0
  641. data/shoes/ruby/lib/weakref.rb +80 -0
  642. data/shoes/ruby/lib/webrick/accesslog.rb +75 -0
  643. data/shoes/ruby/lib/webrick/cgi.rb +260 -0
  644. data/shoes/ruby/lib/webrick/compat.rb +15 -0
  645. data/shoes/ruby/lib/webrick/config.rb +100 -0
  646. data/shoes/ruby/lib/webrick/cookie.rb +110 -0
  647. data/shoes/ruby/lib/webrick/htmlutils.rb +25 -0
  648. data/shoes/ruby/lib/webrick/httpauth/authenticator.rb +79 -0
  649. data/shoes/ruby/lib/webrick/httpauth/basicauth.rb +65 -0
  650. data/shoes/ruby/lib/webrick/httpauth/digestauth.rb +344 -0
  651. data/shoes/ruby/lib/webrick/httpauth/htdigest.rb +91 -0
  652. data/shoes/ruby/lib/webrick/httpauth/htgroup.rb +61 -0
  653. data/shoes/ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
  654. data/shoes/ruby/lib/webrick/httpauth/userdb.rb +29 -0
  655. data/shoes/ruby/lib/webrick/httpauth.rb +45 -0
  656. data/shoes/ruby/lib/webrick/httpproxy.rb +288 -0
  657. data/shoes/ruby/lib/webrick/httprequest.rb +402 -0
  658. data/shoes/ruby/lib/webrick/httpresponse.rb +326 -0
  659. data/shoes/ruby/lib/webrick/https.rb +63 -0
  660. data/shoes/ruby/lib/webrick/httpserver.rb +217 -0
  661. data/shoes/ruby/lib/webrick/httpservlet/abstract.rb +70 -0
  662. data/shoes/ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  663. data/shoes/ruby/lib/webrick/httpservlet/cgihandler.rb +110 -0
  664. data/shoes/ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
  665. data/shoes/ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
  666. data/shoes/ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
  667. data/shoes/ruby/lib/webrick/httpservlet.rb +22 -0
  668. data/shoes/ruby/lib/webrick/httpstatus.rb +132 -0
  669. data/shoes/ruby/lib/webrick/httputils.rb +392 -0
  670. data/shoes/ruby/lib/webrick/httpversion.rb +49 -0
  671. data/shoes/ruby/lib/webrick/log.rb +88 -0
  672. data/shoes/ruby/lib/webrick/server.rb +210 -0
  673. data/shoes/ruby/lib/webrick/ssl.rb +126 -0
  674. data/shoes/ruby/lib/webrick/utils.rb +175 -0
  675. data/shoes/ruby/lib/webrick/version.rb +13 -0
  676. data/shoes/ruby/lib/webrick.rb +29 -0
  677. data/shoes/ruby/lib/win32/registry.rb +832 -0
  678. data/shoes/ruby/lib/win32/resolv.rb +370 -0
  679. data/shoes/ruby/lib/win32/sspi.rb +330 -0
  680. data/shoes/ruby/lib/win32ole/property.rb +16 -0
  681. data/shoes/ruby/lib/xmlrpc/base64.rb +81 -0
  682. data/shoes/ruby/lib/xmlrpc/client.rb +625 -0
  683. data/shoes/ruby/lib/xmlrpc/config.rb +40 -0
  684. data/shoes/ruby/lib/xmlrpc/create.rb +290 -0
  685. data/shoes/ruby/lib/xmlrpc/datetime.rb +142 -0
  686. data/shoes/ruby/lib/xmlrpc/httpserver.rb +178 -0
  687. data/shoes/ruby/lib/xmlrpc/marshal.rb +76 -0
  688. data/shoes/ruby/lib/xmlrpc/parser.rb +813 -0
  689. data/shoes/ruby/lib/xmlrpc/server.rb +778 -0
  690. data/shoes/ruby/lib/xmlrpc/utils.rb +165 -0
  691. data/shoes/ruby/lib/yaml/baseemitter.rb +242 -0
  692. data/shoes/ruby/lib/yaml/basenode.rb +216 -0
  693. data/shoes/ruby/lib/yaml/constants.rb +45 -0
  694. data/shoes/ruby/lib/yaml/dbm.rb +111 -0
  695. data/shoes/ruby/lib/yaml/encoding.rb +33 -0
  696. data/shoes/ruby/lib/yaml/error.rb +34 -0
  697. data/shoes/ruby/lib/yaml/loader.rb +14 -0
  698. data/shoes/ruby/lib/yaml/rubytypes.rb +446 -0
  699. data/shoes/ruby/lib/yaml/store.rb +43 -0
  700. data/shoes/ruby/lib/yaml/stream.rb +40 -0
  701. data/shoes/ruby/lib/yaml/stringio.rb +83 -0
  702. data/shoes/ruby/lib/yaml/syck.rb +19 -0
  703. data/shoes/ruby/lib/yaml/tag.rb +91 -0
  704. data/shoes/ruby/lib/yaml/types.rb +192 -0
  705. data/shoes/ruby/lib/yaml/yamlnode.rb +54 -0
  706. data/shoes/ruby/lib/yaml/ypath.rb +52 -0
  707. data/shoes/ruby/lib/yaml.rb +440 -0
  708. data/shoes/samples/class-book.rb +43 -0
  709. data/shoes/samples/class-book.yaml +387 -0
  710. data/shoes/samples/expert-definr.rb +23 -0
  711. data/shoes/samples/expert-funnies.rb +51 -0
  712. data/shoes/samples/expert-irb.rb +112 -0
  713. data/shoes/samples/expert-minesweeper.rb +267 -0
  714. data/shoes/samples/expert-othello.rb +319 -0
  715. data/shoes/samples/expert-pong.rb +62 -0
  716. data/shoes/samples/expert-tankspank.rb +385 -0
  717. data/shoes/samples/good-arc.rb +37 -0
  718. data/shoes/samples/good-clock.rb +51 -0
  719. data/shoes/samples/good-follow.rb +26 -0
  720. data/shoes/samples/good-reminder.rb +174 -0
  721. data/shoes/samples/good-vjot.rb +56 -0
  722. data/shoes/samples/simple-accordion.rb +75 -0
  723. data/shoes/samples/simple-anim-shapes.rb +17 -0
  724. data/shoes/samples/simple-anim-text.rb +13 -0
  725. data/shoes/samples/simple-arc.rb +23 -0
  726. data/shoes/samples/simple-bounce.rb +24 -0
  727. data/shoes/samples/simple-calc.rb +70 -0
  728. data/shoes/samples/simple-control-sizes.rb +24 -0
  729. data/shoes/samples/simple-curve.rb +26 -0
  730. data/shoes/samples/simple-dialogs.rb +29 -0
  731. data/shoes/samples/simple-downloader.rb +27 -0
  732. data/shoes/samples/simple-draw.rb +13 -0
  733. data/shoes/samples/simple-editor.rb +28 -0
  734. data/shoes/samples/simple-form.rb +28 -0
  735. data/shoes/samples/simple-form.shy +0 -0
  736. data/shoes/samples/simple-mask.rb +21 -0
  737. data/shoes/samples/simple-menu.rb +31 -0
  738. data/shoes/samples/simple-menu1.rb +35 -0
  739. data/shoes/samples/simple-rubygems.rb +29 -0
  740. data/shoes/samples/simple-slide.rb +45 -0
  741. data/shoes/samples/simple-sphere.rb +28 -0
  742. data/shoes/samples/simple-timer.rb +13 -0
  743. data/shoes/samples/simple-video.rb +13 -0
  744. data/shoes/shoes +21 -0
  745. data/shoes/shoes.exe +0 -0
  746. data/shoes/shoes.exe.manifest +17 -0
  747. data/shoes/sqlite3.dll +0 -0
  748. data/shoes/static/Shoes.icns +0 -0
  749. data/shoes/static/Thumbs.db +0 -0
  750. data/shoes/static/app-icon.png +0 -0
  751. data/shoes/static/avatar.png +0 -0
  752. data/shoes/static/code_highlighter.js +188 -0
  753. data/shoes/static/code_highlighter_ruby.js +26 -0
  754. data/shoes/static/icon-debug.png +0 -0
  755. data/shoes/static/icon-error.png +0 -0
  756. data/shoes/static/icon-info.png +0 -0
  757. data/shoes/static/icon-warn.png +0 -0
  758. data/shoes/static/listbox_button1.png +0 -0
  759. data/shoes/static/listbox_button2.png +0 -0
  760. data/shoes/static/man-app.png +0 -0
  761. data/shoes/static/man-builds.png +0 -0
  762. data/shoes/static/man-editor-notepad.png +0 -0
  763. data/shoes/static/man-editor-osx.png +0 -0
  764. data/shoes/static/man-ele-background.png +0 -0
  765. data/shoes/static/man-ele-border.png +0 -0
  766. data/shoes/static/man-ele-button.png +0 -0
  767. data/shoes/static/man-ele-check.png +0 -0
  768. data/shoes/static/man-ele-editbox.png +0 -0
  769. data/shoes/static/man-ele-editline.png +0 -0
  770. data/shoes/static/man-ele-image.png +0 -0
  771. data/shoes/static/man-ele-listbox.png +0 -0
  772. data/shoes/static/man-ele-progress.png +0 -0
  773. data/shoes/static/man-ele-radio.png +0 -0
  774. data/shoes/static/man-ele-shape.png +0 -0
  775. data/shoes/static/man-ele-textblock.png +0 -0
  776. data/shoes/static/man-ele-video.png +0 -0
  777. data/shoes/static/man-intro-dmg.png +0 -0
  778. data/shoes/static/man-intro-exe.png +0 -0
  779. data/shoes/static/man-look-tiger.png +0 -0
  780. data/shoes/static/man-look-ubuntu.png +0 -0
  781. data/shoes/static/man-look-vista.png +0 -0
  782. data/shoes/static/man-run-osx.png +0 -0
  783. data/shoes/static/man-run-vista.png +0 -0
  784. data/shoes/static/man-run-xp.png +0 -0
  785. data/shoes/static/man-shot1.png +0 -0
  786. data/shoes/static/manual-en.txt +2783 -0
  787. data/shoes/static/manual-ja.txt +2780 -0
  788. data/shoes/static/manual.css +167 -0
  789. data/shoes/static/menu-corner1.png +0 -0
  790. data/shoes/static/menu-corner2.png +0 -0
  791. data/shoes/static/menu-gray.png +0 -0
  792. data/shoes/static/menu-left.png +0 -0
  793. data/shoes/static/menu-right.png +0 -0
  794. data/shoes/static/menu-top.png +0 -0
  795. data/shoes/static/shoes-dmg.jpg +0 -0
  796. data/shoes/static/shoes-icon-blue.png +0 -0
  797. data/shoes/static/shoes-icon.png +0 -0
  798. data/shoes/static/shoes-manual-apps.gif +0 -0
  799. data/shoes/static/stripe.png +0 -0
  800. data/shoes/static/stubs/blank.exe +0 -0
  801. data/shoes/static/stubs/blank.hfz +0 -0
  802. data/shoes/static/stubs/blank.run +375 -0
  803. data/shoes/static/stubs/cocoa-install +0 -0
  804. data/shoes/static/stubs/sh-install +48 -0
  805. data/shoes/static/tutor-back.png +0 -0
  806. data/shoes/zlib.dll +0 -0
  807. data/shoes/zlib1.dll +0 -0
  808. metadata +887 -0
@@ -0,0 +1,1313 @@
1
+ # format.rb: Written by Tadayoshi Funaba 1999-2008
2
+ # $Id: format.rb,v 2.43 2008-01-17 20:16:31+09 tadf Exp $
3
+
4
+ class Date
5
+
6
+ module Format # :nodoc:
7
+
8
+ MONTHS = {
9
+ 'january' => 1, 'february' => 2, 'march' => 3, 'april' => 4,
10
+ 'may' => 5, 'june' => 6, 'july' => 7, 'august' => 8,
11
+ 'september'=> 9, 'october' =>10, 'november' =>11, 'december' =>12
12
+ }
13
+
14
+ DAYS = {
15
+ 'sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday'=> 3,
16
+ 'thursday' => 4, 'friday' => 5, 'saturday' => 6
17
+ }
18
+
19
+ ABBR_MONTHS = {
20
+ 'jan' => 1, 'feb' => 2, 'mar' => 3, 'apr' => 4,
21
+ 'may' => 5, 'jun' => 6, 'jul' => 7, 'aug' => 8,
22
+ 'sep' => 9, 'oct' =>10, 'nov' =>11, 'dec' =>12
23
+ }
24
+
25
+ ABBR_DAYS = {
26
+ 'sun' => 0, 'mon' => 1, 'tue' => 2, 'wed' => 3,
27
+ 'thu' => 4, 'fri' => 5, 'sat' => 6
28
+ }
29
+
30
+ ZONES = {
31
+ 'ut' => 0*3600, 'gmt' => 0*3600, 'est' => -5*3600, 'edt' => -4*3600,
32
+ 'cst' => -6*3600, 'cdt' => -5*3600, 'mst' => -7*3600, 'mdt' => -6*3600,
33
+ 'pst' => -8*3600, 'pdt' => -7*3600,
34
+ 'a' => 1*3600, 'b' => 2*3600, 'c' => 3*3600, 'd' => 4*3600,
35
+ 'e' => 5*3600, 'f' => 6*3600, 'g' => 7*3600, 'h' => 8*3600,
36
+ 'i' => 9*3600, 'k' => 10*3600, 'l' => 11*3600, 'm' => 12*3600,
37
+ 'n' => -1*3600, 'o' => -2*3600, 'p' => -3*3600, 'q' => -4*3600,
38
+ 'r' => -5*3600, 's' => -6*3600, 't' => -7*3600, 'u' => -8*3600,
39
+ 'v' => -9*3600, 'w' =>-10*3600, 'x' =>-11*3600, 'y' =>-12*3600,
40
+ 'z' => 0*3600,
41
+
42
+ 'utc' => 0*3600, 'wet' => 0*3600,
43
+ 'at' => -2*3600, 'brst'=> -2*3600, 'ndt' => -(2*3600+1800),
44
+ 'art' => -3*3600, 'adt' => -3*3600, 'brt' => -3*3600, 'clst'=> -3*3600,
45
+ 'nst' => -(3*3600+1800),
46
+ 'ast' => -4*3600, 'clt' => -4*3600,
47
+ 'akdt'=> -8*3600, 'ydt' => -8*3600,
48
+ 'akst'=> -9*3600, 'hadt'=> -9*3600, 'hdt' => -9*3600, 'yst' => -9*3600,
49
+ 'ahst'=>-10*3600, 'cat' =>-10*3600, 'hast'=>-10*3600, 'hst' =>-10*3600,
50
+ 'nt' =>-11*3600,
51
+ 'idlw'=>-12*3600,
52
+ 'bst' => 1*3600, 'cet' => 1*3600, 'fwt' => 1*3600, 'met' => 1*3600,
53
+ 'mewt'=> 1*3600, 'mez' => 1*3600, 'swt' => 1*3600, 'wat' => 1*3600,
54
+ 'west'=> 1*3600,
55
+ 'cest'=> 2*3600, 'eet' => 2*3600, 'fst' => 2*3600, 'mest'=> 2*3600,
56
+ 'mesz'=> 2*3600, 'sast'=> 2*3600, 'sst' => 2*3600,
57
+ 'bt' => 3*3600, 'eat' => 3*3600, 'eest'=> 3*3600, 'msk' => 3*3600,
58
+ 'msd' => 4*3600, 'zp4' => 4*3600,
59
+ 'zp5' => 5*3600, 'ist' => (5*3600+1800),
60
+ 'zp6' => 6*3600,
61
+ 'wast'=> 7*3600,
62
+ 'cct' => 8*3600, 'sgt' => 8*3600, 'wadt'=> 8*3600,
63
+ 'jst' => 9*3600, 'kst' => 9*3600,
64
+ 'east'=> 10*3600, 'gst' => 10*3600,
65
+ 'eadt'=> 11*3600,
66
+ 'idle'=> 12*3600, 'nzst'=> 12*3600, 'nzt' => 12*3600,
67
+ 'nzdt'=> 13*3600,
68
+
69
+ 'afghanistan' => 16200, 'alaskan' => -32400,
70
+ 'arab' => 10800, 'arabian' => 14400,
71
+ 'arabic' => 10800, 'atlantic' => -14400,
72
+ 'aus central' => 34200, 'aus eastern' => 36000,
73
+ 'azores' => -3600, 'canada central' => -21600,
74
+ 'cape verde' => -3600, 'caucasus' => 14400,
75
+ 'cen. australia' => 34200, 'central america' => -21600,
76
+ 'central asia' => 21600, 'central europe' => 3600,
77
+ 'central european' => 3600, 'central pacific' => 39600,
78
+ 'central' => -21600, 'china' => 28800,
79
+ 'dateline' => -43200, 'e. africa' => 10800,
80
+ 'e. australia' => 36000, 'e. europe' => 7200,
81
+ 'e. south america' => -10800, 'eastern' => -18000,
82
+ 'egypt' => 7200, 'ekaterinburg' => 18000,
83
+ 'fiji' => 43200, 'fle' => 7200,
84
+ 'greenland' => -10800, 'greenwich' => 0,
85
+ 'gtb' => 7200, 'hawaiian' => -36000,
86
+ 'india' => 19800, 'iran' => 12600,
87
+ 'jerusalem' => 7200, 'korea' => 32400,
88
+ 'mexico' => -21600, 'mid-atlantic' => -7200,
89
+ 'mountain' => -25200, 'myanmar' => 23400,
90
+ 'n. central asia' => 21600, 'nepal' => 20700,
91
+ 'new zealand' => 43200, 'newfoundland' => -12600,
92
+ 'north asia east' => 28800, 'north asia' => 25200,
93
+ 'pacific sa' => -14400, 'pacific' => -28800,
94
+ 'romance' => 3600, 'russian' => 10800,
95
+ 'sa eastern' => -10800, 'sa pacific' => -18000,
96
+ 'sa western' => -14400, 'samoa' => -39600,
97
+ 'se asia' => 25200, 'malay peninsula' => 28800,
98
+ 'south africa' => 7200, 'sri lanka' => 21600,
99
+ 'taipei' => 28800, 'tasmania' => 36000,
100
+ 'tokyo' => 32400, 'tonga' => 46800,
101
+ 'us eastern' => -18000, 'us mountain' => -25200,
102
+ 'vladivostok' => 36000, 'w. australia' => 28800,
103
+ 'w. central africa' => 3600, 'w. europe' => 3600,
104
+ 'west asia' => 18000, 'west pacific' => 36000,
105
+ 'yakutsk' => 32400
106
+ }
107
+
108
+ [MONTHS, DAYS, ABBR_MONTHS, ABBR_DAYS, ZONES].each do |x|
109
+ x.freeze
110
+ end
111
+
112
+ class Bag # :nodoc:
113
+
114
+ def initialize
115
+ @elem = {}
116
+ end
117
+
118
+ def method_missing(t, *args, &block)
119
+ t = t.to_s
120
+ set = t.chomp!('=')
121
+ t = t.intern
122
+ if set
123
+ @elem[t] = args[0]
124
+ else
125
+ @elem[t]
126
+ end
127
+ end
128
+
129
+ def to_hash
130
+ @elem.reject{|k, v| /\A_/ =~ k.to_s || v.nil?}
131
+ end
132
+
133
+ end
134
+
135
+ end
136
+
137
+ def emit(e, f) # :nodoc:
138
+ case e
139
+ when Numeric
140
+ sign = %w(+ + -)[e <=> 0]
141
+ e = e.abs
142
+ end
143
+
144
+ s = e.to_s
145
+
146
+ if f[:s] && f[:p] == '0'
147
+ f[:w] -= 1
148
+ end
149
+
150
+ if f[:s] && f[:p] == "\s"
151
+ s[0,0] = sign
152
+ end
153
+
154
+ if f[:p] != '-'
155
+ s = s.rjust(f[:w], f[:p])
156
+ end
157
+
158
+ if f[:s] && f[:p] != "\s"
159
+ s[0,0] = sign
160
+ end
161
+
162
+ s = s.upcase if f[:u]
163
+ s = s.downcase if f[:d]
164
+ s
165
+ end
166
+
167
+ def emit_w(e, w, f) # :nodoc:
168
+ f[:w] = [f[:w], w].compact.max
169
+ emit(e, f)
170
+ end
171
+
172
+ def emit_n(e, w, f) # :nodoc:
173
+ f[:p] ||= '0'
174
+ emit_w(e, w, f)
175
+ end
176
+
177
+ def emit_sn(e, w, f) # :nodoc:
178
+ if e < 0
179
+ w += 1
180
+ f[:s] = true
181
+ end
182
+ emit_n(e, w, f)
183
+ end
184
+
185
+ def emit_z(e, w, f) # :nodoc:
186
+ w += 1
187
+ f[:s] = true
188
+ emit_n(e, w, f)
189
+ end
190
+
191
+ def emit_a(e, w, f) # :nodoc:
192
+ f[:p] ||= "\s"
193
+ emit_w(e, w, f)
194
+ end
195
+
196
+ def emit_ad(e, w, f) # :nodoc:
197
+ if f[:x]
198
+ f[:u] = true
199
+ f[:d] = false
200
+ end
201
+ emit_a(e, w, f)
202
+ end
203
+
204
+ def emit_au(e, w, f) # :nodoc:
205
+ if f[:x]
206
+ f[:u] = false
207
+ f[:d] = true
208
+ end
209
+ emit_a(e, w, f)
210
+ end
211
+
212
+ private :emit, :emit_w, :emit_n, :emit_sn, :emit_z,
213
+ :emit_a, :emit_ad, :emit_au
214
+
215
+ def strftime(fmt='%F')
216
+ fmt.gsub(/%([-_0^#]+)?(\d+)?([EO]?(?::{1,3}z|.))/m) do
217
+ f = {}
218
+ m = $&
219
+ s, w, c = $1, $2, $3
220
+ if s
221
+ s.scan(/./) do |k|
222
+ case k
223
+ when '-'; f[:p] = '-'
224
+ when '_'; f[:p] = "\s"
225
+ when '0'; f[:p] = '0'
226
+ when '^'; f[:u] = true
227
+ when '#'; f[:x] = true
228
+ end
229
+ end
230
+ end
231
+ if w
232
+ f[:w] = w.to_i
233
+ end
234
+ case c
235
+ when 'A'; emit_ad(DAYNAMES[wday], 0, f)
236
+ when 'a'; emit_ad(ABBR_DAYNAMES[wday], 0, f)
237
+ when 'B'; emit_ad(MONTHNAMES[mon], 0, f)
238
+ when 'b'; emit_ad(ABBR_MONTHNAMES[mon], 0, f)
239
+ when 'C', 'EC'; emit_sn((year / 100).floor, 2, f)
240
+ when 'c', 'Ec'; emit_a(strftime('%a %b %e %H:%M:%S %Y'), 0, f)
241
+ when 'D'; emit_a(strftime('%m/%d/%y'), 0, f)
242
+ when 'd', 'Od'; emit_n(mday, 2, f)
243
+ when 'e', 'Oe'; emit_a(mday, 2, f)
244
+ when 'F'
245
+ if m == '%F'
246
+ format('%.4d-%02d-%02d', year, mon, mday) # 4p
247
+ else
248
+ emit_a(strftime('%Y-%m-%d'), 0, f)
249
+ end
250
+ when 'G'; emit_sn(cwyear, 4, f)
251
+ when 'g'; emit_n(cwyear % 100, 2, f)
252
+ when 'H', 'OH'; emit_n(hour, 2, f)
253
+ when 'h'; emit_ad(strftime('%b'), 0, f)
254
+ when 'I', 'OI'; emit_n((hour % 12).nonzero? || 12, 2, f)
255
+ when 'j'; emit_n(yday, 3, f)
256
+ when 'k'; emit_a(hour, 2, f)
257
+ when 'L'
258
+ f[:p] = nil
259
+ w = f[:w] || 3
260
+ u = 10**w
261
+ emit_n((sec_fraction * u).floor, w, f)
262
+ when 'l'; emit_a((hour % 12).nonzero? || 12, 2, f)
263
+ when 'M', 'OM'; emit_n(min, 2, f)
264
+ when 'm', 'Om'; emit_n(mon, 2, f)
265
+ when 'N'
266
+ f[:p] = nil
267
+ w = f[:w] || 9
268
+ u = 10**w
269
+ emit_n((sec_fraction * u).floor, w, f)
270
+ when 'n'; emit_a("\n", 0, f)
271
+ when 'P'; emit_ad(strftime('%p').downcase, 0, f)
272
+ when 'p'; emit_au(if hour < 12 then 'AM' else 'PM' end, 0, f)
273
+ when 'Q'
274
+ s = ((ajd - UNIX_EPOCH_IN_AJD) / MILLISECONDS_IN_DAY).round
275
+ emit_sn(s, 1, f)
276
+ when 'R'; emit_a(strftime('%H:%M'), 0, f)
277
+ when 'r'; emit_a(strftime('%I:%M:%S %p'), 0, f)
278
+ when 'S', 'OS'; emit_n(sec, 2, f)
279
+ when 's'
280
+ s = ((ajd - UNIX_EPOCH_IN_AJD) / SECONDS_IN_DAY).round
281
+ emit_sn(s, 1, f)
282
+ when 'T'
283
+ if m == '%T'
284
+ format('%02d:%02d:%02d', hour, min, sec) # 4p
285
+ else
286
+ emit_a(strftime('%H:%M:%S'), 0, f)
287
+ end
288
+ when 't'; emit_a("\t", 0, f)
289
+ when 'U', 'W', 'OU', 'OW'
290
+ emit_n(if c[-1,1] == 'U' then wnum0 else wnum1 end, 2, f)
291
+ when 'u', 'Ou'; emit_n(cwday, 1, f)
292
+ when 'V', 'OV'; emit_n(cweek, 2, f)
293
+ when 'v'; emit_a(strftime('%e-%b-%Y'), 0, f)
294
+ when 'w', 'Ow'; emit_n(wday, 1, f)
295
+ when 'X', 'EX'; emit_a(strftime('%H:%M:%S'), 0, f)
296
+ when 'x', 'Ex'; emit_a(strftime('%m/%d/%y'), 0, f)
297
+ when 'Y', 'EY'; emit_sn(year, 4, f)
298
+ when 'y', 'Ey', 'Oy'; emit_n(year % 100, 2, f)
299
+ when 'Z'; emit_au(strftime('%:z'), 0, f)
300
+ when /\A(:{0,3})z/
301
+ t = $1.size
302
+ sign = if offset < 0 then -1 else +1 end
303
+ fr = offset.abs
304
+ ss = fr.div(SECONDS_IN_DAY) # 4p
305
+ hh, ss = ss.divmod(3600)
306
+ mm, ss = ss.divmod(60)
307
+ if t == 3
308
+ if ss.nonzero? then t = 2
309
+ elsif mm.nonzero? then t = 1
310
+ else t = -1
311
+ end
312
+ end
313
+ case t
314
+ when -1
315
+ tail = []
316
+ sep = ''
317
+ when 0
318
+ f[:w] -= 2 if f[:w]
319
+ tail = ['%02d' % mm]
320
+ sep = ''
321
+ when 1
322
+ f[:w] -= 3 if f[:w]
323
+ tail = ['%02d' % mm]
324
+ sep = ':'
325
+ when 2
326
+ f[:w] -= 6 if f[:w]
327
+ tail = ['%02d' % mm, '%02d' % ss]
328
+ sep = ':'
329
+ end
330
+ ([emit_z(sign * hh, 2, f)] + tail).join(sep)
331
+ when '%'; emit_a('%', 0, f)
332
+ when '+'; emit_a(strftime('%a %b %e %H:%M:%S %Z %Y'), 0, f)
333
+ else
334
+ m
335
+ end
336
+ end
337
+ end
338
+
339
+ # alias_method :format, :strftime
340
+
341
+ def asctime() strftime('%c') end
342
+
343
+ alias_method :ctime, :asctime
344
+
345
+ def iso8601() strftime('%F') end
346
+
347
+ def rfc3339() iso8601 end
348
+
349
+ def xmlschema() iso8601 end # :nodoc:
350
+
351
+ def rfc2822() strftime('%a, %-d %b %Y %T %z') end
352
+
353
+ alias_method :rfc822, :rfc2822
354
+
355
+ def httpdate() new_offset(0).strftime('%a, %d %b %Y %T GMT') end # :nodoc:
356
+
357
+ def jisx0301
358
+ if jd < 2405160
359
+ iso8601
360
+ else
361
+ case jd
362
+ when 2405160...2419614
363
+ g = 'M%02d' % (year - 1867)
364
+ when 2419614...2424875
365
+ g = 'T%02d' % (year - 1911)
366
+ when 2424875...2447535
367
+ g = 'S%02d' % (year - 1925)
368
+ else
369
+ g = 'H%02d' % (year - 1988)
370
+ end
371
+ g + strftime('.%m.%d')
372
+ end
373
+ end
374
+
375
+ =begin
376
+ def beat(n=0)
377
+ i, f = (new_offset(HOURS_IN_DAY).day_fraction * 1000).divmod(1)
378
+ ('@%03d' % i) +
379
+ if n < 1
380
+ ''
381
+ else
382
+ '.%0*d' % [n, (f / Rational(1, 10**n)).round]
383
+ end
384
+ end
385
+ =end
386
+
387
+ def self.num_pattern? (s) # :nodoc:
388
+ /\A%[EO]?[CDdeFGgHIjkLlMmNQRrSsTUuVvWwXxYy\d]/ =~ s || /\A\d/ =~ s
389
+ end
390
+
391
+ private_class_method :num_pattern?
392
+
393
+ def self._strptime_i(str, fmt, e) # :nodoc:
394
+ fmt.scan(/%([EO]?(?::{1,3}z|.))|(.)/m) do |s, c|
395
+ a = $&
396
+ if s
397
+ case s
398
+ when 'A', 'a'
399
+ return unless str.sub!(/\A(#{Format::DAYS.keys.join('|')})/io, '') ||
400
+ str.sub!(/\A(#{Format::ABBR_DAYS.keys.join('|')})/io, '')
401
+ val = Format::DAYS[$1.downcase] || Format::ABBR_DAYS[$1.downcase]
402
+ return unless val
403
+ e.wday = val
404
+ when 'B', 'b', 'h'
405
+ return unless str.sub!(/\A(#{Format::MONTHS.keys.join('|')})/io, '') ||
406
+ str.sub!(/\A(#{Format::ABBR_MONTHS.keys.join('|')})/io, '')
407
+ val = Format::MONTHS[$1.downcase] || Format::ABBR_MONTHS[$1.downcase]
408
+ return unless val
409
+ e.mon = val
410
+ when 'C', 'EC'
411
+ return unless str.sub!(if num_pattern?($')
412
+ then /\A([-+]?\d{1,2})/
413
+ else /\A([-+]?\d{1,})/
414
+ end, '')
415
+ val = $1.to_i
416
+ e._cent = val
417
+ when 'c', 'Ec'
418
+ return unless _strptime_i(str, '%a %b %e %H:%M:%S %Y', e)
419
+ when 'D'
420
+ return unless _strptime_i(str, '%m/%d/%y', e)
421
+ when 'd', 'e', 'Od', 'Oe'
422
+ return unless str.sub!(/\A( \d|\d{1,2})/, '')
423
+ val = $1.to_i
424
+ return unless (1..31) === val
425
+ e.mday = val
426
+ when 'F'
427
+ return unless _strptime_i(str, '%Y-%m-%d', e)
428
+ when 'G'
429
+ return unless str.sub!(if num_pattern?($')
430
+ then /\A([-+]?\d{1,4})/
431
+ else /\A([-+]?\d{1,})/
432
+ end, '')
433
+ val = $1.to_i
434
+ e.cwyear = val
435
+ when 'g'
436
+ return unless str.sub!(/\A(\d{1,2})/, '')
437
+ val = $1.to_i
438
+ return unless (0..99) === val
439
+ e.cwyear = val
440
+ e._cent ||= if val >= 69 then 19 else 20 end
441
+ when 'H', 'k', 'OH'
442
+ return unless str.sub!(/\A( \d|\d{1,2})/, '')
443
+ val = $1.to_i
444
+ return unless (0..24) === val
445
+ e.hour = val
446
+ when 'I', 'l', 'OI'
447
+ return unless str.sub!(/\A( \d|\d{1,2})/, '')
448
+ val = $1.to_i
449
+ return unless (1..12) === val
450
+ e.hour = val
451
+ when 'j'
452
+ return unless str.sub!(/\A(\d{1,3})/, '')
453
+ val = $1.to_i
454
+ return unless (1..366) === val
455
+ e.yday = val
456
+ when 'L'
457
+ return unless str.sub!(if num_pattern?($')
458
+ then /\A([-+]?\d{1,3})/
459
+ else /\A([-+]?\d{1,})/
460
+ end, '')
461
+ # val = Rational($1.to_i, 10**3)
462
+ val = Rational($1.to_i, 10**$1.size)
463
+ e.sec_fraction = val
464
+ when 'M', 'OM'
465
+ return unless str.sub!(/\A(\d{1,2})/, '')
466
+ val = $1.to_i
467
+ return unless (0..59) === val
468
+ e.min = val
469
+ when 'm', 'Om'
470
+ return unless str.sub!(/\A(\d{1,2})/, '')
471
+ val = $1.to_i
472
+ return unless (1..12) === val
473
+ e.mon = val
474
+ when 'N'
475
+ return unless str.sub!(if num_pattern?($')
476
+ then /\A([-+]?\d{1,9})/
477
+ else /\A([-+]?\d{1,})/
478
+ end, '')
479
+ # val = Rational($1.to_i, 10**9)
480
+ val = Rational($1.to_i, 10**$1.size)
481
+ e.sec_fraction = val
482
+ when 'n', 't'
483
+ return unless _strptime_i(str, "\s", e)
484
+ when 'P', 'p'
485
+ return unless str.sub!(/\A([ap])(?:m\b|\.m\.)/i, '')
486
+ e._merid = if $1.downcase == 'a' then 0 else 12 end
487
+ when 'Q'
488
+ return unless str.sub!(/\A(-?\d{1,})/, '')
489
+ val = Rational($1.to_i, 10**3)
490
+ e.seconds = val
491
+ when 'R'
492
+ return unless _strptime_i(str, '%H:%M', e)
493
+ when 'r'
494
+ return unless _strptime_i(str, '%I:%M:%S %p', e)
495
+ when 'S', 'OS'
496
+ return unless str.sub!(/\A(\d{1,2})/, '')
497
+ val = $1.to_i
498
+ return unless (0..60) === val
499
+ e.sec = val
500
+ when 's'
501
+ return unless str.sub!(/\A(-?\d{1,})/, '')
502
+ val = $1.to_i
503
+ e.seconds = val
504
+ when 'T'
505
+ return unless _strptime_i(str, '%H:%M:%S', e)
506
+ when 'U', 'W', 'OU', 'OW'
507
+ return unless str.sub!(/\A(\d{1,2})/, '')
508
+ val = $1.to_i
509
+ return unless (0..53) === val
510
+ e.__send__(if s[-1,1] == 'U' then :wnum0= else :wnum1= end, val)
511
+ when 'u', 'Ou'
512
+ return unless str.sub!(/\A(\d{1})/, '')
513
+ val = $1.to_i
514
+ return unless (1..7) === val
515
+ e.cwday = val
516
+ when 'V', 'OV'
517
+ return unless str.sub!(/\A(\d{1,2})/, '')
518
+ val = $1.to_i
519
+ return unless (1..53) === val
520
+ e.cweek = val
521
+ when 'v'
522
+ return unless _strptime_i(str, '%e-%b-%Y', e)
523
+ when 'w'
524
+ return unless str.sub!(/\A(\d{1})/, '')
525
+ val = $1.to_i
526
+ return unless (0..6) === val
527
+ e.wday = val
528
+ when 'X', 'EX'
529
+ return unless _strptime_i(str, '%H:%M:%S', e)
530
+ when 'x', 'Ex'
531
+ return unless _strptime_i(str, '%m/%d/%y', e)
532
+ when 'Y', 'EY'
533
+ return unless str.sub!(if num_pattern?($')
534
+ then /\A([-+]?\d{1,4})/
535
+ else /\A([-+]?\d{1,})/
536
+ end, '')
537
+ val = $1.to_i
538
+ e.year = val
539
+ when 'y', 'Ey', 'Oy'
540
+ return unless str.sub!(/\A(\d{1,2})/, '')
541
+ val = $1.to_i
542
+ return unless (0..99) === val
543
+ e.year = val
544
+ e._cent ||= if val >= 69 then 19 else 20 end
545
+ when 'Z', /\A:{0,3}z/
546
+ return unless str.sub!(/\A((?:gmt|utc?)?[-+]\d+(?:[,.:]\d+(?::\d+)?)?
547
+ |[[:alpha:].\s]+(?:standard|daylight)\s+time\b
548
+ |[[:alpha:]]+(?:\s+dst)?\b
549
+ )/ix, '')
550
+ val = $1
551
+ e.zone = val
552
+ offset = zone_to_diff(val)
553
+ e.offset = offset
554
+ when '%'
555
+ return unless str.sub!(/\A%/, '')
556
+ when '+'
557
+ return unless _strptime_i(str, '%a %b %e %H:%M:%S %Z %Y', e)
558
+ else
559
+ return unless str.sub!(Regexp.new('\\A' + Regexp.quote(a)), '')
560
+ end
561
+ else
562
+ case c
563
+ when /\A[\s\v]/
564
+ str.sub!(/\A[\s\v]+/, '')
565
+ else
566
+ return unless str.sub!(Regexp.new('\\A' + Regexp.quote(a)), '')
567
+ end
568
+ end
569
+ end
570
+ end
571
+
572
+ private_class_method :_strptime_i
573
+
574
+ def self._strptime(str, fmt='%F')
575
+ str = str.dup
576
+ e = Format::Bag.new
577
+ return unless _strptime_i(str, fmt, e)
578
+
579
+ if e._cent
580
+ if e.cwyear
581
+ e.cwyear += e._cent * 100
582
+ end
583
+ if e.year
584
+ e. year += e._cent * 100
585
+ end
586
+ end
587
+
588
+ if e._merid
589
+ if e.hour
590
+ e.hour %= 12
591
+ e.hour += e._merid
592
+ end
593
+ end
594
+
595
+ unless str.empty?
596
+ e.leftover = str
597
+ end
598
+
599
+ e.to_hash
600
+ end
601
+
602
+ def self.s3e(e, y, m, d, bc=false)
603
+ unless String === m
604
+ m = m.to_s
605
+ end
606
+
607
+ if y && m && !d
608
+ y, m, d = d, y, m
609
+ end
610
+
611
+ if y == nil
612
+ if d && d.size > 2
613
+ y = d
614
+ d = nil
615
+ end
616
+ if d && d[0,1] == "'"
617
+ y = d
618
+ d = nil
619
+ end
620
+ end
621
+
622
+ if y
623
+ y.scan(/(\d+)(.+)?/)
624
+ if $2
625
+ y, d = d, $1
626
+ end
627
+ end
628
+
629
+ if m
630
+ if m[0,1] == "'" || m.size > 2
631
+ y, m, d = m, d, y # us -> be
632
+ end
633
+ end
634
+
635
+ if d
636
+ if d[0,1] == "'" || d.size > 2
637
+ y, d = d, y
638
+ end
639
+ end
640
+
641
+ if y
642
+ y =~ /([-+])?(\d+)/
643
+ if $1 || $2.size > 2
644
+ c = false
645
+ end
646
+ iy = $&.to_i
647
+ if bc
648
+ iy = -iy + 1
649
+ end
650
+ e.year = iy
651
+ end
652
+
653
+ if m
654
+ m =~ /\d+/
655
+ e.mon = $&.to_i
656
+ end
657
+
658
+ if d
659
+ d =~ /\d+/
660
+ e.mday = $&.to_i
661
+ end
662
+
663
+ if c != nil
664
+ e._comp = c
665
+ end
666
+
667
+ end
668
+
669
+ private_class_method :s3e
670
+
671
+ def self._parse_day(str, e) # :nodoc:
672
+ if str.sub!(/\b(#{Format::ABBR_DAYS.keys.join('|')})[^-\d\s]*/io, ' ')
673
+ e.wday = Format::ABBR_DAYS[$1.downcase]
674
+ true
675
+ =begin
676
+ elsif str.sub!(/\b(?!\dth)(su|mo|tu|we|th|fr|sa)\b/i, ' ')
677
+ e.wday = %w(su mo tu we th fr sa).index($1.downcase)
678
+ true
679
+ =end
680
+ end
681
+ end
682
+
683
+ def self._parse_time(str, e) # :nodoc:
684
+ if str.sub!(
685
+ /(
686
+ (?:
687
+ \d+\s*:\s*\d+
688
+ (?:
689
+ \s*:\s*\d+(?:[,.]\d*)?
690
+ )?
691
+ |
692
+ \d+\s*h(?:\s*\d+m?(?:\s*\d+s?)?)?
693
+ )
694
+ (?:
695
+ \s*
696
+ [ap](?:m\b|\.m\.)
697
+ )?
698
+ |
699
+ \d+\s*[ap](?:m\b|\.m\.)
700
+ )
701
+ (?:
702
+ \s*
703
+ (
704
+ (?:gmt|utc?)?[-+]\d+(?:[,.:]\d+(?::\d+)?)?
705
+ |
706
+ [[:alpha:].\s]+(?:standard|daylight)\stime\b
707
+ |
708
+ [[:alpha:]]+(?:\sdst)?\b
709
+ )
710
+ )?
711
+ /ix,
712
+ ' ')
713
+
714
+ t = $1
715
+ e.zone = $2 if $2
716
+
717
+ t =~ /\A(\d+)h?
718
+ (?:\s*:?\s*(\d+)m?
719
+ (?:
720
+ \s*:?\s*(\d+)(?:[,.](\d+))?s?
721
+ )?
722
+ )?
723
+ (?:\s*([ap])(?:m\b|\.m\.))?/ix
724
+
725
+ e.hour = $1.to_i
726
+ e.min = $2.to_i if $2
727
+ e.sec = $3.to_i if $3
728
+ e.sec_fraction = Rational($4.to_i, 10**$4.size) if $4
729
+
730
+ if $5
731
+ e.hour %= 12
732
+ if $5.downcase == 'p'
733
+ e.hour += 12
734
+ end
735
+ end
736
+ true
737
+ end
738
+ end
739
+
740
+ =begin
741
+ def self._parse_beat(str, e) # :nodoc:
742
+ if str.sub!(/@\s*(\d+)(?:[,.](\d*))?/, ' ')
743
+ beat = Rational($1.to_i)
744
+ beat += Rational($2.to_i, 10**$2.size) if $2
745
+ secs = Rational(beat, 1000)
746
+ h, min, s, fr = self.day_fraction_to_time(secs)
747
+ e.hour = h
748
+ e.min = min
749
+ e.sec = s
750
+ e.sec_fraction = fr * 86400
751
+ e.zone = '+01:00'
752
+ true
753
+ end
754
+ end
755
+ =end
756
+
757
+ def self._parse_eu(str, e) # :nodoc:
758
+ if str.sub!(
759
+ /'?(\d+)[^-\d\s]*
760
+ \s*
761
+ (#{Format::ABBR_MONTHS.keys.join('|')})[^-\d\s']*
762
+ (?:
763
+ \s*
764
+ (c(?:e|\.e\.)|b(?:ce|\.c\.e\.)|a(?:d|\.d\.)|b(?:c|\.c\.))?
765
+ \s*
766
+ ('?-?\d+(?:(?:st|nd|rd|th)\b)?)
767
+ )?
768
+ /iox,
769
+ ' ') # '
770
+ s3e(e, $4, Format::ABBR_MONTHS[$2.downcase], $1,
771
+ $3 && $3[0,1].downcase == 'b')
772
+ true
773
+ end
774
+ end
775
+
776
+ def self._parse_us(str, e) # :nodoc:
777
+ if str.sub!(
778
+ /\b(#{Format::ABBR_MONTHS.keys.join('|')})[^-\d\s']*
779
+ \s*
780
+ ('?\d+)[^-\d\s']*
781
+ (?:
782
+ \s*
783
+ (c(?:e|\.e\.)|b(?:ce|\.c\.e\.)|a(?:d|\.d\.)|b(?:c|\.c\.))?
784
+ \s*
785
+ ('?-?\d+)
786
+ )?
787
+ /iox,
788
+ ' ') # '
789
+ s3e(e, $4, Format::ABBR_MONTHS[$1.downcase], $2,
790
+ $3 && $3[0,1].downcase == 'b')
791
+ true
792
+ end
793
+ end
794
+
795
+ def self._parse_iso(str, e) # :nodoc:
796
+ if str.sub!(/('?[-+]?\d+)-(\d+)-('?-?\d+)/, ' ')
797
+ s3e(e, $1, $2, $3)
798
+ true
799
+ end
800
+ end
801
+
802
+ def self._parse_iso2(str, e) # :nodoc:
803
+ if str.sub!(/\b(\d{2}|\d{4})?-?w(\d{2})(?:-?(\d))?\b/i, ' ')
804
+ e.cwyear = $1.to_i if $1
805
+ e.cweek = $2.to_i
806
+ e.cwday = $3.to_i if $3
807
+ true
808
+ elsif str.sub!(/-w-(\d)\b/i, ' ')
809
+ e.cwday = $1.to_i
810
+ true
811
+ elsif str.sub!(/--(\d{2})?-(\d{2})\b/, ' ')
812
+ e.mon = $1.to_i if $1
813
+ e.mday = $2.to_i
814
+ true
815
+ elsif str.sub!(/--(\d{2})(\d{2})?\b/, ' ')
816
+ e.mon = $1.to_i
817
+ e.mday = $2.to_i if $2
818
+ true
819
+ elsif /[,.](\d{2}|\d{4})-\d{3}\b/ !~ str &&
820
+ str.sub!(/\b(\d{2}|\d{4})-(\d{3})\b/, ' ')
821
+ e.year = $1.to_i
822
+ e.yday = $2.to_i
823
+ true
824
+ elsif /\d-\d{3}\b/ !~ str &&
825
+ str.sub!(/\b-(\d{3})\b/, ' ')
826
+ e.yday = $1.to_i
827
+ true
828
+ end
829
+ end
830
+
831
+ def self._parse_jis(str, e) # :nodoc:
832
+ if str.sub!(/\b([mtsh])(\d+)\.(\d+)\.(\d+)/i, ' ')
833
+ era = { 'm'=>1867,
834
+ 't'=>1911,
835
+ 's'=>1925,
836
+ 'h'=>1988
837
+ }[$1.downcase]
838
+ e.year = $2.to_i + era
839
+ e.mon = $3.to_i
840
+ e.mday = $4.to_i
841
+ true
842
+ end
843
+ end
844
+
845
+ def self._parse_vms(str, e) # :nodoc:
846
+ if str.sub!(/('?-?\d+)-(#{Format::ABBR_MONTHS.keys.join('|')})[^-]*
847
+ -('?-?\d+)/iox, ' ')
848
+ s3e(e, $3, Format::ABBR_MONTHS[$2.downcase], $1)
849
+ true
850
+ elsif str.sub!(/\b(#{Format::ABBR_MONTHS.keys.join('|')})[^-]*
851
+ -('?-?\d+)(?:-('?-?\d+))?/iox, ' ')
852
+ s3e(e, $3, Format::ABBR_MONTHS[$1.downcase], $2)
853
+ true
854
+ end
855
+ end
856
+
857
+ def self._parse_sla(str, e) # :nodoc:
858
+ if str.sub!(%r|('?-?\d+)/\s*('?\d+)(?:\D\s*('?-?\d+))?|, ' ') # '
859
+ s3e(e, $1, $2, $3)
860
+ true
861
+ end
862
+ end
863
+
864
+ def self._parse_dot(str, e) # :nodoc:
865
+ if str.sub!(%r|('?-?\d+)\.\s*('?\d+)\.\s*('?-?\d+)|, ' ') # '
866
+ s3e(e, $1, $2, $3)
867
+ true
868
+ end
869
+ end
870
+
871
+ def self._parse_year(str, e) # :nodoc:
872
+ if str.sub!(/'(\d+)\b/, ' ')
873
+ e.year = $1.to_i
874
+ true
875
+ end
876
+ end
877
+
878
+ def self._parse_mon(str, e) # :nodoc:
879
+ if str.sub!(/\b(#{Format::ABBR_MONTHS.keys.join('|')})\S*/io, ' ')
880
+ e.mon = Format::ABBR_MONTHS[$1.downcase]
881
+ true
882
+ end
883
+ end
884
+
885
+ def self._parse_mday(str, e) # :nodoc:
886
+ if str.sub!(/(\d+)(st|nd|rd|th)\b/i, ' ')
887
+ e.mday = $1.to_i
888
+ true
889
+ end
890
+ end
891
+
892
+ def self._parse_ddd(str, e) # :nodoc:
893
+ if str.sub!(
894
+ /([-+]?)(\d{2,14})
895
+ (?:
896
+ \s*
897
+ t?
898
+ \s*
899
+ (\d{2,6})?(?:[,.](\d*))?
900
+ )?
901
+ (?:
902
+ \s*
903
+ (
904
+ z\b
905
+ |
906
+ [-+]\d{1,4}\b
907
+ |
908
+ \[[-+]?\d[^\]]*\]
909
+ )
910
+ )?
911
+ /ix,
912
+ ' ')
913
+ case $2.size
914
+ when 2
915
+ if $3.nil? && $4
916
+ e.sec = $2[-2, 2].to_i
917
+ else
918
+ e.mday = $2[ 0, 2].to_i
919
+ end
920
+ when 4
921
+ if $3.nil? && $4
922
+ e.sec = $2[-2, 2].to_i
923
+ e.min = $2[-4, 2].to_i
924
+ else
925
+ e.mon = $2[ 0, 2].to_i
926
+ e.mday = $2[ 2, 2].to_i
927
+ end
928
+ when 6
929
+ if $3.nil? && $4
930
+ e.sec = $2[-2, 2].to_i
931
+ e.min = $2[-4, 2].to_i
932
+ e.hour = $2[-6, 2].to_i
933
+ else
934
+ e.year = ($1 + $2[ 0, 2]).to_i
935
+ e.mon = $2[ 2, 2].to_i
936
+ e.mday = $2[ 4, 2].to_i
937
+ end
938
+ when 8, 10, 12, 14
939
+ if $3.nil? && $4
940
+ e.sec = $2[-2, 2].to_i
941
+ e.min = $2[-4, 2].to_i
942
+ e.hour = $2[-6, 2].to_i
943
+ e.mday = $2[-8, 2].to_i
944
+ if $2.size >= 10
945
+ e.mon = $2[-10, 2].to_i
946
+ end
947
+ if $2.size == 12
948
+ e.year = ($1 + $2[-12, 2]).to_i
949
+ end
950
+ if $2.size == 14
951
+ e.year = ($1 + $2[-14, 4]).to_i
952
+ e._comp = false
953
+ end
954
+ else
955
+ e.year = ($1 + $2[ 0, 4]).to_i
956
+ e.mon = $2[ 4, 2].to_i
957
+ e.mday = $2[ 6, 2].to_i
958
+ e.hour = $2[ 8, 2].to_i if $2.size >= 10
959
+ e.min = $2[10, 2].to_i if $2.size >= 12
960
+ e.sec = $2[12, 2].to_i if $2.size >= 14
961
+ e._comp = false
962
+ end
963
+ when 3
964
+ if $3.nil? && $4
965
+ e.sec = $2[-2, 2].to_i
966
+ e.min = $2[-3, 1].to_i
967
+ else
968
+ e.yday = $2[ 0, 3].to_i
969
+ end
970
+ when 5
971
+ if $3.nil? && $4
972
+ e.sec = $2[-2, 2].to_i
973
+ e.min = $2[-4, 2].to_i
974
+ e.hour = $2[-5, 1].to_i
975
+ else
976
+ e.year = ($1 + $2[ 0, 2]).to_i
977
+ e.yday = $2[ 2, 3].to_i
978
+ end
979
+ when 7
980
+ if $3.nil? && $4
981
+ e.sec = $2[-2, 2].to_i
982
+ e.min = $2[-4, 2].to_i
983
+ e.hour = $2[-6, 2].to_i
984
+ e.mday = $2[-7, 1].to_i
985
+ else
986
+ e.year = ($1 + $2[ 0, 4]).to_i
987
+ e.yday = $2[ 4, 3].to_i
988
+ end
989
+ end
990
+ if $3
991
+ if $4
992
+ case $3.size
993
+ when 2, 4, 6
994
+ e.sec = $3[-2, 2].to_i
995
+ e.min = $3[-4, 2].to_i if $3.size >= 4
996
+ e.hour = $3[-6, 2].to_i if $3.size >= 6
997
+ end
998
+ else
999
+ case $3.size
1000
+ when 2, 4, 6
1001
+ e.hour = $3[ 0, 2].to_i
1002
+ e.min = $3[ 2, 2].to_i if $3.size >= 4
1003
+ e.sec = $3[ 4, 2].to_i if $3.size >= 6
1004
+ end
1005
+ end
1006
+ end
1007
+ if $4
1008
+ e.sec_fraction = Rational($4.to_i, 10**$4.size)
1009
+ end
1010
+ if $5
1011
+ e.zone = $5
1012
+ if e.zone[0,1] == '['
1013
+ o, n, = e.zone[1..-2].split(':')
1014
+ e.zone = n || o
1015
+ if /\A\d/ =~ o
1016
+ o = format('+%s', o)
1017
+ end
1018
+ e.offset = zone_to_diff(o)
1019
+ end
1020
+ end
1021
+ true
1022
+ end
1023
+ end
1024
+
1025
+ private_class_method :_parse_day, :_parse_time, # :_parse_beat,
1026
+ :_parse_eu, :_parse_us, :_parse_iso, :_parse_iso2,
1027
+ :_parse_jis, :_parse_vms, :_parse_sla, :_parse_dot,
1028
+ :_parse_year, :_parse_mon, :_parse_mday, :_parse_ddd
1029
+
1030
+ def self._parse(str, comp=true)
1031
+ str = str.dup
1032
+
1033
+ e = Format::Bag.new
1034
+
1035
+ e._comp = comp
1036
+
1037
+ str.gsub!(/[^-+',.\/:@[:alnum:]\[\]]+/, ' ')
1038
+
1039
+ _parse_time(str, e) # || _parse_beat(str, e)
1040
+ _parse_day(str, e)
1041
+
1042
+ _parse_eu(str, e) ||
1043
+ _parse_us(str, e) ||
1044
+ _parse_iso(str, e) ||
1045
+ _parse_jis(str, e) ||
1046
+ _parse_vms(str, e) ||
1047
+ _parse_sla(str, e) ||
1048
+ _parse_dot(str, e) ||
1049
+ _parse_iso2(str, e) ||
1050
+ _parse_year(str, e) ||
1051
+ _parse_mon(str, e) ||
1052
+ _parse_mday(str, e) ||
1053
+ _parse_ddd(str, e)
1054
+
1055
+ if str.sub!(/\b(bc\b|bce\b|b\.c\.|b\.c\.e\.)/i, ' ')
1056
+ if e.year
1057
+ e.year = -e.year + 1
1058
+ end
1059
+ end
1060
+
1061
+ if str.sub!(/\A\s*(\d{1,2})\s*\z/, ' ')
1062
+ if e.hour && !e.mday
1063
+ v = $1.to_i
1064
+ if (1..31) === v
1065
+ e.mday = v
1066
+ end
1067
+ end
1068
+ if e.mday && !e.hour
1069
+ v = $1.to_i
1070
+ if (0..24) === v
1071
+ e.hour = v
1072
+ end
1073
+ end
1074
+ end
1075
+
1076
+ if e._comp
1077
+ if e.cwyear
1078
+ if e.cwyear >= 0 && e.cwyear <= 99
1079
+ e.cwyear += if e.cwyear >= 69
1080
+ then 1900 else 2000 end
1081
+ end
1082
+ end
1083
+ if e.year
1084
+ if e.year >= 0 && e.year <= 99
1085
+ e.year += if e.year >= 69
1086
+ then 1900 else 2000 end
1087
+ end
1088
+ end
1089
+ end
1090
+
1091
+ e.offset ||= zone_to_diff(e.zone) if e.zone
1092
+
1093
+ e.to_hash
1094
+ end
1095
+
1096
+ def self._iso8601(str) # :nodoc:
1097
+ if /\A\s*(([-+]?\d{2,}|-)-\d{2}-\d{2}|
1098
+ ([-+]?\d{2,})?-\d{3}|
1099
+ (\d{2}|\d{4})?-w\d{2}-\d|
1100
+ -w-\d)
1101
+ (t
1102
+ \d{2}:\d{2}(:\d{2}([,.]\d+)?)?
1103
+ (z|[-+]\d{2}(:?\d{2})?)?)?\s*\z/ix =~ str
1104
+ _parse(str)
1105
+ elsif /\A\s*(([-+]?(\d{2}|\d{4})|--)\d{2}\d{2}|
1106
+ ([-+]?(\d{2}|\d{4}))?\d{3}|-\d{3}|
1107
+ (\d{2}|\d{4})?w\d{2}\d)
1108
+ (t?
1109
+ \d{2}\d{2}(\d{2}([,.]\d+)?)?
1110
+ (z|[-+]\d{2}(\d{2})?)?)?\s*\z/ix =~ str
1111
+ _parse(str)
1112
+ elsif /\A\s*(\d{2}:\d{2}(:\d{2}([,.]\d+)?)?
1113
+ (z|[-+]\d{2}(:?\d{2})?)?)?\s*\z/ix =~ str
1114
+ _parse(str)
1115
+ elsif /\A\s*(\d{2}\d{2}(\d{2}([,.]\d+)?)?
1116
+ (z|[-+]\d{2}(\d{2})?)?)?\s*\z/ix =~ str
1117
+ _parse(str)
1118
+ end
1119
+ end
1120
+
1121
+ def self._rfc3339(str) # :nodoc:
1122
+ if /\A\s*-?\d{4}-\d{2}-\d{2} # allow minus, anyway
1123
+ (t|\s)
1124
+ \d{2}:\d{2}:\d{2}(\.\d+)?
1125
+ (z|[-+]\d{2}:\d{2})\s*\z/ix =~ str
1126
+ _parse(str)
1127
+ end
1128
+ end
1129
+
1130
+ def self._xmlschema(str) # :nodoc:
1131
+ if /\A\s*(-?\d{4,})(?:-(\d{2})(?:-(\d{2}))?)?
1132
+ (?:t
1133
+ (\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?)?
1134
+ (z|[-+]\d{2}:\d{2})?\s*\z/ix =~ str
1135
+ e = Format::Bag.new
1136
+ e.year = $1.to_i
1137
+ e.mon = $2.to_i if $2
1138
+ e.mday = $3.to_i if $3
1139
+ e.hour = $4.to_i if $4
1140
+ e.min = $5.to_i if $5
1141
+ e.sec = $6.to_i if $6
1142
+ e.sec_fraction = Rational($7.to_i, 10**$7.size) if $7
1143
+ if $8
1144
+ e.zone = $8
1145
+ e.offset = zone_to_diff($8)
1146
+ end
1147
+ e.to_hash
1148
+ elsif /\A\s*(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?
1149
+ (z|[-+]\d{2}:\d{2})?\s*\z/ix =~ str
1150
+ e = Format::Bag.new
1151
+ e.hour = $1.to_i if $1
1152
+ e.min = $2.to_i if $2
1153
+ e.sec = $3.to_i if $3
1154
+ e.sec_fraction = Rational($4.to_i, 10**$4.size) if $4
1155
+ if $5
1156
+ e.zone = $5
1157
+ e.offset = zone_to_diff($5)
1158
+ end
1159
+ e.to_hash
1160
+ elsif /\A\s*(?:--(\d{2})(?:-(\d{2}))?|---(\d{2}))
1161
+ (z|[-+]\d{2}:\d{2})?\s*\z/ix =~ str
1162
+ e = Format::Bag.new
1163
+ e.mon = $1.to_i if $1
1164
+ e.mday = $2.to_i if $2
1165
+ e.mday = $3.to_i if $3
1166
+ if $4
1167
+ e.zone = $4
1168
+ e.offset = zone_to_diff($4)
1169
+ end
1170
+ e.to_hash
1171
+ end
1172
+ end
1173
+
1174
+ def self._rfc2822(str) # :nodoc:
1175
+ if /\A\s*(?:(?:#{Format::ABBR_DAYS.keys.join('|')})\s*,\s+)?
1176
+ \d{1,2}\s+
1177
+ (?:#{Format::ABBR_MONTHS.keys.join('|')})\s+
1178
+ -?(\d{2,})\s+ # allow minus, anyway
1179
+ \d{2}:\d{2}(:\d{2})?\s*
1180
+ (?:[-+]\d{4}|ut|gmt|e[sd]t|c[sd]t|m[sd]t|p[sd]t|[a-ik-z])\s*\z/iox =~ str
1181
+ e = _parse(str, false)
1182
+ if $1.size < 4
1183
+ if e[:year] < 50
1184
+ e[:year] += 2000
1185
+ elsif e[:year] < 1000
1186
+ e[:year] += 1900
1187
+ end
1188
+ end
1189
+ e
1190
+ end
1191
+ end
1192
+
1193
+ class << self; alias_method :_rfc822, :_rfc2822 end
1194
+
1195
+ def self._httpdate(str) # :nodoc:
1196
+ if /\A\s*(#{Format::ABBR_DAYS.keys.join('|')})\s*,\s+
1197
+ \d{2}\s+
1198
+ (#{Format::ABBR_MONTHS.keys.join('|')})\s+
1199
+ -?\d{4}\s+ # allow minus, anyway
1200
+ \d{2}:\d{2}:\d{2}\s+
1201
+ gmt\s*\z/iox =~ str
1202
+ _rfc2822(str)
1203
+ elsif /\A\s*(#{Format::DAYS.keys.join('|')})\s*,\s+
1204
+ \d{2}\s*-\s*
1205
+ (#{Format::ABBR_MONTHS.keys.join('|')})\s*-\s*
1206
+ \d{2}\s+
1207
+ \d{2}:\d{2}:\d{2}\s+
1208
+ gmt\s*\z/iox =~ str
1209
+ _parse(str)
1210
+ elsif /\A\s*(#{Format::ABBR_DAYS.keys.join('|')})\s+
1211
+ (#{Format::ABBR_MONTHS.keys.join('|')})\s+
1212
+ \d{1,2}\s+
1213
+ \d{2}:\d{2}:\d{2}\s+
1214
+ \d{4}\s*\z/iox =~ str
1215
+ _parse(str)
1216
+ end
1217
+ end
1218
+
1219
+ def self._jisx0301(str) # :nodoc:
1220
+ if /\A\s*[mtsh]?\d{2}\.\d{2}\.\d{2}
1221
+ (t
1222
+ (\d{2}:\d{2}(:\d{2}([,.]\d*)?)?
1223
+ (z|[-+]\d{2}(:?\d{2})?)?)?)?\s*\z/ix =~ str
1224
+ if /\A\s*\d/ =~ str
1225
+ _parse(str.sub(/\A\s*(\d)/, 'h\1'))
1226
+ else
1227
+ _parse(str)
1228
+ end
1229
+ else
1230
+ _iso8601(str)
1231
+ end
1232
+ end
1233
+
1234
+ t = Module.new do
1235
+
1236
+ private
1237
+
1238
+ def zone_to_diff(zone) # :nodoc:
1239
+ zone = zone.downcase
1240
+ if zone.sub!(/\s+(standard|daylight)\s+time\z/, '')
1241
+ dst = $1 == 'daylight'
1242
+ else
1243
+ dst = zone.sub!(/\s+dst\z/, '')
1244
+ end
1245
+ if Format::ZONES.include?(zone)
1246
+ offset = Format::ZONES[zone]
1247
+ offset += 3600 if dst
1248
+ elsif zone.sub!(/\A(?:gmt|utc?)?([-+])/, '')
1249
+ sign = $1
1250
+ if zone.include?(':')
1251
+ hour, min, sec, = zone.split(':')
1252
+ elsif zone.include?(',') || zone.include?('.')
1253
+ hour, fr, = zone.split(/[,.]/)
1254
+ min = Rational(fr.to_i, 10**fr.size) * 60
1255
+ else
1256
+ case zone.size
1257
+ when 3
1258
+ hour = zone[0,1]
1259
+ min = zone[1,2]
1260
+ else
1261
+ hour = zone[0,2]
1262
+ min = zone[2,2]
1263
+ sec = zone[4,2]
1264
+ end
1265
+ end
1266
+ offset = hour.to_i * 3600 + min.to_i * 60 + sec.to_i
1267
+ offset *= -1 if sign == '-'
1268
+ end
1269
+ offset
1270
+ end
1271
+
1272
+ end
1273
+
1274
+ extend t
1275
+ include t
1276
+
1277
+ end
1278
+
1279
+ class DateTime < Date
1280
+
1281
+ def strftime(fmt='%FT%T%:z')
1282
+ super(fmt)
1283
+ end
1284
+
1285
+ def self._strptime(str, fmt='%FT%T%z')
1286
+ super(str, fmt)
1287
+ end
1288
+
1289
+ def iso8601_timediv(n) # :nodoc:
1290
+ strftime('T%T' +
1291
+ if n < 1
1292
+ ''
1293
+ else
1294
+ '.%0*d' % [n, (sec_fraction / Rational(1, 10**n)).round]
1295
+ end +
1296
+ '%:z')
1297
+ end
1298
+
1299
+ private :iso8601_timediv
1300
+
1301
+ def iso8601(n=0)
1302
+ super() + iso8601_timediv(n)
1303
+ end
1304
+
1305
+ def rfc3339(n=0) iso8601(n) end
1306
+
1307
+ def xmlschema(n=0) iso8601(n) end # :nodoc:
1308
+
1309
+ def jisx0301(n=0)
1310
+ super() + iso8601_timediv(n)
1311
+ end
1312
+
1313
+ end