facets 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (589) hide show
  1. data/{doc/AUTHORS → AUTHORS} +12 -3
  2. data/README +35 -29
  3. data/WARNING +56 -0
  4. data/demo/annotation/demo_annotation.rb +22 -0
  5. data/demo/ansicolor/cdiff.rb +20 -0
  6. data/demo/ansicolor/example.rb +82 -0
  7. data/demo/io-reactor/chatserver.rb +347 -0
  8. data/demo/lisp/game.rb +47 -0
  9. data/lib/facet/all.rb +1 -0
  10. data/lib/facet/annattr.rb +1 -0
  11. data/lib/facet/class/to_proc.rb +1 -0
  12. data/lib/facet/cookie.rb +1 -0
  13. data/lib/facet/dir/self/descend.rb +1 -0
  14. data/lib/facet/enumerable/count.rb +1 -0
  15. data/lib/facet/hash/to_proc.rb +1 -0
  16. data/lib/facet/hashbuilder.rb +1 -0
  17. data/lib/facet/http.rb +1 -0
  18. data/lib/facet/httpaccess.rb +1 -0
  19. data/lib/facet/kernel/__get__.rb +1 -0
  20. data/lib/facet/kernel/__set__.rb +1 -0
  21. data/lib/facet/kernel/cache.rb +1 -0
  22. data/lib/facet/kernel/respond.rb +1 -0
  23. data/lib/facet/lazy.rb +1 -0
  24. data/lib/facet/module/class.rb +1 -0
  25. data/lib/facet/module/nodef.rb +1 -0
  26. data/lib/facet/opencascade.rb +1 -0
  27. data/lib/facet/pqueue.rb +1 -0
  28. data/lib/facet/taskable.rb +1 -0
  29. data/lib/facets.rb +98 -37
  30. data/lib/facets/core/all.rb +5 -0
  31. data/lib/facets/core/class/to_proc.rb +25 -0
  32. data/lib/facets/core/dir/self/ascend.rb +2 -1
  33. data/lib/facets/core/dir/self/descend.rb +11 -0
  34. data/lib/facets/core/enumerable/accumulate.rb +2 -2
  35. data/lib/facets/core/enumerable/count.rb +54 -0
  36. data/lib/facets/core/enumerable/cross.rb +3 -0
  37. data/lib/facets/core/enumerable/graph.rb +8 -4
  38. data/lib/facets/core/enumerable/self/cross.rb +11 -5
  39. data/lib/facets/core/hash/to_proc.rb +34 -0
  40. data/lib/facets/core/hash/traverse.rb +10 -5
  41. data/lib/facets/core/kernel/__class__.rb +1 -1
  42. data/lib/facets/core/kernel/__get__.rb +5 -0
  43. data/lib/facets/core/kernel/__set__.rb +2 -0
  44. data/lib/facets/core/kernel/assign_from.rb +1 -1
  45. data/lib/facets/core/kernel/assign_with.rb +11 -3
  46. data/lib/facets/core/kernel/bool.rb +1 -1
  47. data/lib/facets/core/kernel/cache.rb +31 -0
  48. data/lib/facets/core/kernel/demo.rb +4 -0
  49. data/lib/facets/core/kernel/get_by_id.rb +1 -0
  50. data/lib/facets/core/kernel/in.rb +1 -1
  51. data/lib/facets/core/kernel/instance_assign.rb +2 -3
  52. data/lib/facets/core/kernel/method.rb +25 -7
  53. data/lib/facets/core/kernel/methods.rb +1 -1
  54. data/lib/facets/core/kernel/new.rb +1 -1
  55. data/lib/facets/core/kernel/object_class.rb +1 -1
  56. data/lib/facets/core/kernel/object_hexid.rb +1 -1
  57. data/lib/facets/core/kernel/own.rb +1 -1
  58. data/lib/facets/core/kernel/require_all.rb +1 -0
  59. data/lib/facets/core/kernel/require_esc.rb +4 -2
  60. data/lib/facets/core/kernel/require_facet.rb +2 -0
  61. data/lib/facets/core/kernel/require_local.rb +1 -0
  62. data/lib/facets/core/kernel/respond.rb +14 -0
  63. data/lib/facets/core/kernel/send_as.rb +1 -1
  64. data/lib/facets/core/kernel/silence_warnings.rb +1 -1
  65. data/lib/facets/core/kernel/singleton.rb +3 -1
  66. data/lib/facets/core/matchdata/matchtree.rb +13 -3
  67. data/lib/facets/core/module/class.rb +3 -0
  68. data/lib/facets/core/module/integrate.rb +31 -4
  69. data/lib/facets/core/module/{undef.rb → nodef.rb} +8 -3
  70. data/lib/facets/core/module/revisal.rb +5 -5
  71. data/lib/facets/more/annattr.rb +147 -0
  72. data/lib/facets/more/annotation.rb +32 -136
  73. data/lib/facets/more/ansicode.rb +89 -100
  74. data/lib/facets/more/aspects.rb +28 -0
  75. data/lib/facets/more/association.rb +88 -47
  76. data/lib/facets/more/basicobject.rb +51 -33
  77. data/lib/facets/more/bbcode.rb +21 -34
  78. data/lib/facets/more/binaryreader.rb +62 -33
  79. data/lib/facets/more/bitmask.rb +24 -24
  80. data/lib/facets/more/blankslate.rb +4 -0
  81. data/lib/facets/more/builderobject.rb +16 -20
  82. data/lib/facets/more/bytes.rb +43 -24
  83. data/lib/facets/more/classinherit.rb +15 -31
  84. data/lib/facets/more/classmethods.rb +19 -29
  85. data/lib/facets/more/cloneable.rb +42 -30
  86. data/lib/facets/more/consoleapp.rb +42 -22
  87. data/lib/facets/more/cookie.rb +565 -0
  88. data/lib/facets/more/coroutine.rb +17 -21
  89. data/lib/facets/more/crypt.rb +33 -12
  90. data/lib/facets/more/dictionary.rb +27 -36
  91. data/lib/facets/more/downloader.rb +21 -17
  92. data/lib/facets/more/elementor.rb +22 -0
  93. data/lib/facets/more/enumerablepass.rb +19 -27
  94. data/lib/facets/more/expirable.rb +18 -28
  95. data/lib/facets/more/filelist.rb +33 -32
  96. data/lib/facets/more/floatstring.rb +31 -40
  97. data/lib/facets/more/functor.rb +15 -25
  98. data/lib/facets/more/hashbuilder.rb +76 -0
  99. data/lib/facets/more/heap.rb +29 -36
  100. data/lib/facets/more/htmlbuilder.rb +22 -24
  101. data/lib/facets/more/htmlhelper.rb +89 -0
  102. data/lib/facets/more/http.rb +570 -0
  103. data/lib/facets/more/httpaccess.rb +1608 -0
  104. data/lib/facets/more/inheritor.rb +29 -21
  105. data/lib/facets/more/interval.rb +21 -25
  106. data/lib/facets/more/ioredirect.rb +21 -25
  107. data/lib/facets/more/json.rb +27 -17
  108. data/lib/facets/more/lazy.rb +238 -0
  109. data/lib/facets/more/lisp.rb +24 -27
  110. data/lib/facets/more/lisp_format.rb +93 -85
  111. data/lib/facets/more/lrucache.rb +17 -27
  112. data/lib/facets/more/mathconstants.rb +22 -40
  113. data/lib/facets/more/methodprobe.rb +56 -61
  114. data/lib/facets/more/mock.rb +24 -17
  115. data/lib/facets/more/multipliers.rb +21 -17
  116. data/lib/facets/more/multiton.rb +18 -24
  117. data/lib/facets/more/nackclass.rb +17 -21
  118. data/lib/facets/more/nilcomparable.rb +28 -30
  119. data/lib/facets/more/nullclass.rb +16 -15
  120. data/lib/facets/more/one.rb +94 -58
  121. data/lib/facets/more/opencascade.rb +187 -0
  122. data/lib/facets/more/openobject.rb +89 -66
  123. data/lib/facets/more/orderedhash.rb +4 -0
  124. data/lib/facets/more/ormsupport.rb +18 -29
  125. data/lib/facets/more/overload.rb +39 -3
  126. data/lib/facets/more/paramix.rb +16 -24
  127. data/lib/facets/more/pathlist.rb +17 -23
  128. data/lib/facets/more/pool.rb +21 -29
  129. data/lib/facets/more/pqueue.rb +190 -0
  130. data/lib/facets/more/preinitialize.rb +17 -18
  131. data/lib/facets/more/progressbar.rb +19 -15
  132. data/lib/facets/more/promoteself.rb +17 -21
  133. data/lib/facets/more/quaternion.rb +379 -346
  134. data/lib/facets/more/recorder.rb +15 -20
  135. data/lib/facets/more/reference.rb +25 -22
  136. data/lib/facets/more/rexmlbuilder.rb +21 -6
  137. data/lib/facets/more/rtals.rb +27 -24
  138. data/lib/facets/more/semaphore.rb +15 -28
  139. data/lib/facets/more/snapshot.rb +45 -41
  140. data/lib/facets/more/stateparser.rb +25 -35
  141. data/lib/facets/more/statichash.rb +37 -29
  142. data/lib/facets/more/syncarray.rb +18 -26
  143. data/lib/facets/more/synchash.rb +17 -26
  144. data/lib/facets/more/system.rb +25 -17
  145. data/lib/facets/more/tagiterator.rb +15 -39
  146. data/lib/facets/more/taskable.rb +417 -0
  147. data/lib/facets/more/timer.rb +22 -26
  148. data/lib/facets/more/times.rb +23 -23
  149. data/lib/facets/more/tracepoint.rb +25 -24
  150. data/lib/facets/more/tuple.rb +25 -42
  151. data/lib/facets/more/typecast.rb +27 -29
  152. data/lib/facets/more/uninheritable.rb +15 -22
  153. data/lib/facets/more/units.rb +23 -29
  154. data/lib/facets/more/xmlbuilder.rb +20 -22
  155. data/lib/facets/more/xmlhelper.rb +18 -21
  156. data/lib/facets/more/xoxo.rb +23 -11
  157. data/lib/facets/more/yamlstruct.rb +25 -22
  158. data/test/lib/facets/core/array/test_at_rand.rb +1 -1
  159. data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
  160. data/test/lib/facets/core/array/test_delete_values.rb +1 -1
  161. data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
  162. data/test/lib/facets/core/array/test_first.rb +1 -1
  163. data/test/lib/facets/core/array/test_head.rb +1 -1
  164. data/test/lib/facets/core/array/test_last_index.rb +1 -1
  165. data/test/lib/facets/core/array/test_merge.rb +1 -1
  166. data/test/lib/facets/core/array/test_mid.rb +1 -1
  167. data/test/lib/facets/core/array/test_middle.rb +1 -1
  168. data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
  169. data/test/lib/facets/core/array/test_op_store.rb +1 -1
  170. data/test/lib/facets/core/array/test_pick.rb +1 -1
  171. data/test/lib/facets/core/array/test_pos.rb +1 -1
  172. data/test/lib/facets/core/array/test_pot.rb +1 -1
  173. data/test/lib/facets/core/array/test_pull.rb +1 -1
  174. data/test/lib/facets/core/array/test_rand_index.rb +1 -1
  175. data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
  176. data/test/lib/facets/core/array/test_range.rb +1 -1
  177. data/test/lib/facets/core/array/test_rotate.rb +1 -1
  178. data/test/lib/facets/core/array/test_select.rb +1 -1
  179. data/test/lib/facets/core/array/test_shuffle.rb +1 -1
  180. data/test/lib/facets/core/array/test_thru.rb +1 -1
  181. data/test/lib/facets/core/array/test_to_b.rb +1 -1
  182. data/test/lib/facets/core/array/test_to_h.rb +1 -1
  183. data/test/lib/facets/core/array/test_to_hash.rb +1 -1
  184. data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
  185. data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
  186. data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
  187. data/test/lib/facets/core/binding/test_called.rb +1 -1
  188. data/test/lib/facets/core/binding/test_caller.rb +1 -1
  189. data/test/lib/facets/core/binding/test_defined.rb +1 -1
  190. data/test/lib/facets/core/binding/test_eval.rb +1 -1
  191. data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
  192. data/test/lib/facets/core/binding/test_method_name.rb +1 -1
  193. data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
  194. data/test/lib/facets/core/binding/test_op_store.rb +1 -1
  195. data/test/lib/facets/core/binding/test_self.rb +1 -1
  196. data/test/lib/facets/core/class/test_cattr.rb +1 -1
  197. data/test/lib/facets/core/class/test_descendents.rb +1 -1
  198. data/test/lib/facets/core/class/test_method_name.rb +1 -1
  199. data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
  200. data/test/lib/facets/core/class/test_unix_path.rb +1 -1
  201. data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
  202. data/test/lib/facets/core/comparable/test_clip.rb +1 -1
  203. data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
  204. data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
  205. data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
  206. data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
  207. data/test/lib/facets/core/date/test_stamp.rb +1 -1
  208. data/test/lib/facets/core/date/test_to_date.rb +1 -1
  209. data/test/lib/facets/core/date/test_to_s.rb +1 -1
  210. data/test/lib/facets/core/date/test_to_time.rb +1 -1
  211. data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
  212. data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
  213. data/test/lib/facets/core/enumerable/self/test_combinations.rb +1 -1
  214. data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
  215. data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
  216. data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
  217. data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
  218. data/test/lib/facets/core/enumerable/test_count.rb +38 -0
  219. data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
  220. data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
  221. data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
  222. data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
  223. data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
  224. data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
  225. data/test/lib/facets/core/enumerable/test_every.rb +1 -1
  226. data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
  227. data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
  228. data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
  229. data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
  230. data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
  231. data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
  232. data/test/lib/facets/core/enumerable/test_none.rb +1 -1
  233. data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
  234. data/test/lib/facets/core/enumerable/test_one.rb +1 -1
  235. data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
  236. data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
  237. data/test/lib/facets/core/enumerable/test_permute.rb +1 -1
  238. data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
  239. data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
  240. data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
  241. data/test/lib/facets/core/file/self/test_create.rb +1 -1
  242. data/test/lib/facets/core/file/self/test_open_as_string.rb +1 -1
  243. data/test/lib/facets/core/file/self/test_read_list.rb +1 -1
  244. data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
  245. data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
  246. data/test/lib/facets/core/float/test_round_at.rb +1 -1
  247. data/test/lib/facets/core/float/test_round_to.rb +1 -1
  248. data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
  249. data/test/lib/facets/core/hash/test_alias.rb +1 -1
  250. data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
  251. data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
  252. data/test/lib/facets/core/hash/test_at.rb +1 -1
  253. data/test/lib/facets/core/hash/test_collate.rb +1 -1
  254. data/test/lib/facets/core/hash/test_each.rb +1 -1
  255. data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
  256. data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
  257. data/test/lib/facets/core/hash/test_graph.rb +1 -1
  258. data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
  259. data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
  260. data/test/lib/facets/core/hash/test_inverse.rb +1 -1
  261. data/test/lib/facets/core/hash/test_keys_to_s.rb +1 -1
  262. data/test/lib/facets/core/hash/test_keys_to_sym.rb +1 -1
  263. data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
  264. data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
  265. data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
  266. data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
  267. data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
  268. data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
  269. data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
  270. data/test/lib/facets/core/hash/test_slice.rb +1 -1
  271. data/test/lib/facets/core/hash/test_swap.rb +1 -1
  272. data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
  273. data/test/lib/facets/core/hash/test_to_h.rb +1 -1
  274. data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
  275. data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
  276. data/test/lib/facets/core/hash/test_traverse.rb +1 -1
  277. data/test/lib/facets/core/hash/test_update_each.rb +1 -1
  278. data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
  279. data/test/lib/facets/core/hash/test_update_values.rb +1 -1
  280. data/test/lib/facets/core/hash/test_weave.rb +1 -1
  281. data/test/lib/facets/core/integer/test_factorial.rb +1 -1
  282. data/test/lib/facets/core/integer/test_multiple.rb +1 -1
  283. data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
  284. data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
  285. data/test/lib/facets/core/kernel/test___class__.rb +1 -1
  286. data/test/lib/facets/core/kernel/test_as.rb +1 -1
  287. data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
  288. data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
  289. data/test/lib/facets/core/kernel/test_bool.rb +1 -1
  290. data/test/lib/facets/core/kernel/test_bug.rb +1 -1
  291. data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
  292. data/test/lib/facets/core/kernel/test_called.rb +1 -1
  293. data/test/lib/facets/core/kernel/test_constant.rb +1 -1
  294. data/test/lib/facets/core/kernel/test_copy.rb +1 -1
  295. data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
  296. data/test/lib/facets/core/kernel/test_demo.rb +1 -1
  297. data/test/lib/facets/core/kernel/test_fn.rb +1 -1
  298. data/test/lib/facets/core/kernel/test_generate_method_name.rb +1 -1
  299. data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
  300. data/test/lib/facets/core/kernel/test_here.rb +1 -1
  301. data/test/lib/facets/core/kernel/test_in.rb +1 -1
  302. data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
  303. data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
  304. data/test/lib/facets/core/kernel/test_method.rb +1 -1
  305. data/test/lib/facets/core/kernel/test_methodname.rb +1 -1
  306. data/test/lib/facets/core/kernel/test_methods.rb +1 -1
  307. data/test/lib/facets/core/kernel/test_new.rb +1 -1
  308. data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
  309. data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
  310. data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
  311. data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
  312. data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
  313. data/test/lib/facets/core/kernel/test_resc.rb +1 -1
  314. data/test/lib/facets/core/kernel/test_returning.rb +1 -1
  315. data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
  316. data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
  317. data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
  318. data/test/lib/facets/core/kernel/test_silently.rb +1 -1
  319. data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
  320. data/test/lib/facets/core/kernel/test_superior.rb +1 -1
  321. data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
  322. data/test/lib/facets/core/kernel/test_this.rb +1 -1
  323. data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
  324. data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
  325. data/test/lib/facets/core/kernel/test_uri.rb +1 -1
  326. data/test/lib/facets/core/kernel/test_val.rb +1 -1
  327. data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
  328. data/test/lib/facets/core/matchdata/test_match.rb +1 -1
  329. data/test/lib/facets/core/matchdata/test_matchtree.rb +7 -2
  330. data/test/lib/facets/core/module/test_abstract.rb +1 -1
  331. data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
  332. data/test/lib/facets/core/module/test_ancestor.rb +1 -1
  333. data/test/lib/facets/core/module/test_basename.rb +1 -1
  334. data/test/lib/facets/core/module/test_by_name.rb +1 -1
  335. data/test/lib/facets/core/module/test_clone_using.rb +1 -1
  336. data/test/lib/facets/core/module/test_dirname.rb +1 -1
  337. data/test/lib/facets/core/module/test_equate_on.rb +1 -1
  338. data/test/lib/facets/core/module/test_generate_instance_method_name.rb +1 -1
  339. data/test/lib/facets/core/module/test_include_as.rb +1 -1
  340. data/test/lib/facets/core/module/test_inherit.rb +1 -1
  341. data/test/lib/facets/core/module/test_initializer.rb +1 -1
  342. data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
  343. data/test/lib/facets/core/module/test_integrate.rb +1 -1
  344. data/test/lib/facets/core/module/test_memoize.rb +1 -1
  345. data/test/lib/facets/core/module/test_modspace.rb +1 -1
  346. data/test/lib/facets/core/module/test_namespace.rb +1 -1
  347. data/test/lib/facets/core/module/test_nesting.rb +1 -1
  348. data/test/lib/facets/core/module/{test_undef.rb → test_nodef.rb} +5 -5
  349. data/test/lib/facets/core/module/test_on_included.rb +1 -1
  350. data/test/lib/facets/core/module/test_redef.rb +1 -1
  351. data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
  352. data/test/lib/facets/core/module/test_redirect.rb +1 -1
  353. data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
  354. data/test/lib/facets/core/module/test_remove.rb +1 -1
  355. data/test/lib/facets/core/module/test_rename.rb +1 -1
  356. data/test/lib/facets/core/module/test_rename_method.rb +1 -1
  357. data/test/lib/facets/core/module/test_revisal.rb +1 -1
  358. data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
  359. data/test/lib/facets/core/module/test_sort_on.rb +1 -1
  360. data/test/lib/facets/core/module/test_this.rb +1 -1
  361. data/test/lib/facets/core/module/test_wrap.rb +1 -1
  362. data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
  363. data/test/lib/facets/core/nilclass/test_blank.rb +1 -1
  364. data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
  365. data/test/lib/facets/core/nilclass/test_include.rb +1 -1
  366. data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
  367. data/test/lib/facets/core/nilclass/test_size.rb +1 -1
  368. data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
  369. data/test/lib/facets/core/numeric/test_approx.rb +1 -1
  370. data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
  371. data/test/lib/facets/core/numeric/test_succ.rb +1 -1
  372. data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
  373. data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
  374. data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
  375. data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
  376. data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
  377. data/test/lib/facets/core/proc/test_compose.rb +1 -1
  378. data/test/lib/facets/core/proc/test_to_method.rb +1 -1
  379. data/test/lib/facets/core/range/test_to_r.rb +1 -1
  380. data/test/lib/facets/core/range/test_to_range.rb +1 -1
  381. data/test/lib/facets/core/range/test_umbrella.rb +1 -1
  382. data/test/lib/facets/core/range/test_within.rb +1 -1
  383. data/test/lib/facets/core/regexp/test_arity.rb +1 -1
  384. data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
  385. data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
  386. data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
  387. data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
  388. data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
  389. data/test/lib/facets/core/string/test_align_center.rb +1 -1
  390. data/test/lib/facets/core/string/test_at_rand.rb +1 -1
  391. data/test/lib/facets/core/string/test_basename.rb +1 -1
  392. data/test/lib/facets/core/string/test_blank.rb +1 -1
  393. data/test/lib/facets/core/string/test_bracket.rb +1 -1
  394. data/test/lib/facets/core/string/test_camelcase.rb +1 -1
  395. data/test/lib/facets/core/string/test_camelize.rb +1 -1
  396. data/test/lib/facets/core/string/test_capitalized.rb +1 -1
  397. data/test/lib/facets/core/string/test_chars.rb +1 -1
  398. data/test/lib/facets/core/string/test_cmp.rb +1 -1
  399. data/test/lib/facets/core/string/test_demodulize.rb +1 -1
  400. data/test/lib/facets/core/string/test_downcase.rb +1 -1
  401. data/test/lib/facets/core/string/test_dresner.rb +1 -1
  402. data/test/lib/facets/core/string/test_each_char.rb +1 -1
  403. data/test/lib/facets/core/string/test_each_word.rb +1 -1
  404. data/test/lib/facets/core/string/test_first.rb +1 -1
  405. data/test/lib/facets/core/string/test_fold.rb +1 -1
  406. data/test/lib/facets/core/string/test_frequency.rb +1 -1
  407. data/test/lib/facets/core/string/test_humanize.rb +1 -1
  408. data/test/lib/facets/core/string/test_indent.rb +1 -1
  409. data/test/lib/facets/core/string/test_index_all.rb +1 -1
  410. data/test/lib/facets/core/string/test_last.rb +1 -1
  411. data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
  412. data/test/lib/facets/core/string/test_lines.rb +1 -1
  413. data/test/lib/facets/core/string/test_lowercase.rb +1 -1
  414. data/test/lib/facets/core/string/test_margin.rb +1 -1
  415. data/test/lib/facets/core/string/test_methodize.rb +1 -1
  416. data/test/lib/facets/core/string/test_modulize.rb +1 -1
  417. data/test/lib/facets/core/string/test_mscan.rb +1 -1
  418. data/test/lib/facets/core/string/test_natcmp.rb +1 -1
  419. data/test/lib/facets/core/string/test_nchar.rb +1 -1
  420. data/test/lib/facets/core/string/test_pathize.rb +1 -1
  421. data/test/lib/facets/core/string/test_pop.rb +1 -1
  422. data/test/lib/facets/core/string/test_pot.rb +1 -1
  423. data/test/lib/facets/core/string/test_probability.rb +1 -1
  424. data/test/lib/facets/core/string/test_push.rb +1 -1
  425. data/test/lib/facets/core/string/test_quote.rb +1 -1
  426. data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
  427. data/test/lib/facets/core/string/test_rand_index.rb +1 -1
  428. data/test/lib/facets/core/string/test_range.rb +1 -1
  429. data/test/lib/facets/core/string/test_range_all.rb +1 -1
  430. data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
  431. data/test/lib/facets/core/string/test_regesc.rb +1 -1
  432. data/test/lib/facets/core/string/test_shatter.rb +1 -1
  433. data/test/lib/facets/core/string/test_shift.rb +1 -1
  434. data/test/lib/facets/core/string/test_shuffle.rb +1 -1
  435. data/test/lib/facets/core/string/test_similarity.rb +1 -1
  436. data/test/lib/facets/core/string/test_singular.rb +1 -1
  437. data/test/lib/facets/core/string/test_soundex.rb +1 -1
  438. data/test/lib/facets/core/string/test_succ.rb +1 -1
  439. data/test/lib/facets/core/string/test_to_a.rb +1 -1
  440. data/test/lib/facets/core/string/test_to_b.rb +1 -1
  441. data/test/lib/facets/core/string/test_to_const.rb +1 -1
  442. data/test/lib/facets/core/string/test_to_date.rb +1 -1
  443. data/test/lib/facets/core/string/test_to_proc.rb +1 -1
  444. data/test/lib/facets/core/string/test_to_re.rb +1 -1
  445. data/test/lib/facets/core/string/test_to_time.rb +1 -1
  446. data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
  447. data/test/lib/facets/core/string/test_unpack.rb +1 -1
  448. data/test/lib/facets/core/string/test_unshift.rb +1 -1
  449. data/test/lib/facets/core/string/test_upcase.rb +1 -1
  450. data/test/lib/facets/core/string/test_whitespace.rb +1 -1
  451. data/test/lib/facets/core/string/test_word_filter.rb +1 -1
  452. data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
  453. data/test/lib/facets/core/string/test_words.rb +1 -1
  454. data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
  455. data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
  456. data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
  457. data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
  458. data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
  459. data/test/lib/facets/core/symbol/test_not.rb +1 -1
  460. data/test/lib/facets/core/symbol/test_pad.rb +1 -1
  461. data/test/lib/facets/core/symbol/test_succ.rb +1 -1
  462. data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
  463. data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
  464. data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
  465. data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
  466. data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
  467. data/test/lib/facets/core/time/test_change.rb +1 -1
  468. data/test/lib/facets/core/time/test_elapse.rb +1 -1
  469. data/test/lib/facets/core/time/test_stamp.rb +1 -1
  470. data/test/lib/facets/core/time/test_to_date.rb +1 -1
  471. data/test/lib/facets/core/time/test_to_s.rb +1 -1
  472. data/test/lib/facets/core/time/test_to_time.rb +1 -1
  473. data/test/lib/facets/more/test_annattr.rb +39 -0
  474. data/test/lib/facets/more/test_annotatedattr.rb +39 -0
  475. data/test/lib/facets/more/test_annotation.rb +1 -22
  476. data/test/lib/facets/more/test_ansicode.rb +1 -1
  477. data/test/lib/facets/more/test_association.rb +6 -1
  478. data/test/lib/facets/more/test_basicobject.rb +1 -1
  479. data/test/lib/facets/more/test_bbcode.rb +1 -1
  480. data/test/lib/facets/more/test_binaryreader.rb +64 -0
  481. data/test/lib/facets/more/test_bitmask.rb +1 -1
  482. data/test/lib/facets/more/test_bytes.rb +1 -1
  483. data/test/lib/facets/more/test_classinherit.rb +1 -1
  484. data/test/lib/facets/more/test_classmethods.rb +1 -1
  485. data/test/lib/facets/more/test_coroutine.rb +1 -1
  486. data/test/lib/facets/more/test_crypt.rb +1 -1
  487. data/test/lib/facets/more/test_dictionary.rb +1 -1
  488. data/test/lib/facets/more/test_elementor.rb +1 -1
  489. data/test/lib/facets/more/test_enumerablepass.rb +1 -1
  490. data/test/lib/facets/more/test_floatstring.rb +1 -1
  491. data/test/lib/facets/more/test_functor.rb +1 -1
  492. data/test/lib/facets/more/test_htmlbuilder.rb +1 -1
  493. data/test/lib/facets/more/test_inheritor.rb +1 -1
  494. data/test/lib/facets/more/test_interval.rb +1 -1
  495. data/test/lib/facets/more/test_json.rb +1 -1
  496. data/test/lib/facets/more/test_lisp.rb +1 -1
  497. data/test/lib/facets/more/test_lisp_format.rb +1 -1
  498. data/test/lib/facets/more/test_lrucache.rb +1 -1
  499. data/test/lib/facets/more/test_mathconstants.rb +1 -1
  500. data/test/lib/facets/more/test_methodprobe.rb +1 -1
  501. data/test/lib/facets/more/test_multipliers.rb +1 -1
  502. data/test/lib/facets/more/test_multiton.rb +1 -1
  503. data/test/lib/facets/more/test_nackclass.rb +1 -1
  504. data/test/lib/facets/more/test_nilcomparable.rb +1 -1
  505. data/test/lib/facets/more/test_opencascade.rb +66 -0
  506. data/test/lib/facets/more/test_openobject.rb +14 -2
  507. data/test/lib/facets/more/test_overload.rb +1 -1
  508. data/test/lib/facets/more/test_paramix.rb +1 -1
  509. data/test/lib/facets/more/test_pqueue.rb +39 -0
  510. data/test/lib/facets/more/test_preinitialize.rb +1 -1
  511. data/test/lib/facets/more/test_promoteself.rb +1 -1
  512. data/test/lib/facets/more/test_recorder.rb +1 -1
  513. data/test/lib/facets/more/test_snapshot.rb +1 -1
  514. data/test/lib/facets/more/test_statichash.rb +11 -11
  515. data/test/lib/facets/more/test_syncarray.rb +1 -1
  516. data/test/lib/facets/more/test_synchash.rb +1 -1
  517. data/test/lib/facets/more/test_tagiterator.rb +1 -1
  518. data/test/lib/facets/more/test_taskable.rb +151 -0
  519. data/test/lib/facets/more/test_timer.rb +1 -1
  520. data/test/lib/facets/more/test_times.rb +1 -1
  521. data/test/lib/facets/more/test_tuple.rb +1 -1
  522. data/test/lib/facets/more/test_typecast.rb +1 -1
  523. data/test/lib/facets/more/test_uninheritable.rb +1 -1
  524. data/test/lib/facets/more/test_units.rb +1 -1
  525. data/test/lib/facets/more/test_xmlbuilder.rb +1 -1
  526. data/test/lib/facets/more/test_xmlhelper.rb +1 -1
  527. data/test/lib/facets/more/test_xoxo.rb +1 -1
  528. data/test/lib/facets/more/test_yamlstruct.rb +1 -1
  529. metadata +1243 -1247
  530. data/ProjectInfo +0 -89
  531. data/Rakefile +0 -181
  532. data/doc/CHANGELOG +0 -284
  533. data/doc/TODO +0 -73
  534. data/doc/noauto +0 -63
  535. data/lib/facet/array.rb +0 -1
  536. data/lib/facet/class.rb +0 -1
  537. data/lib/facet/comparable.rb +0 -1
  538. data/lib/facet/continuation.rb +0 -1
  539. data/lib/facet/date.rb +0 -1
  540. data/lib/facet/dir.rb +0 -1
  541. data/lib/facet/enumerable.rb +0 -1
  542. data/lib/facet/file.rb +0 -1
  543. data/lib/facet/fileutils.rb +0 -1
  544. data/lib/facet/float.rb +0 -1
  545. data/lib/facet/gem.rb +0 -1
  546. data/lib/facet/hash.rb +0 -1
  547. data/lib/facet/integer.rb +0 -1
  548. data/lib/facet/kernel.rb +0 -1
  549. data/lib/facet/logger.rb +0 -1
  550. data/lib/facet/matchdata.rb +0 -1
  551. data/lib/facet/module.rb +0 -1
  552. data/lib/facet/module/undef.rb +0 -1
  553. data/lib/facet/nilclass.rb +0 -1
  554. data/lib/facet/numeric.rb +0 -1
  555. data/lib/facet/pathname.rb +0 -1
  556. data/lib/facet/proc.rb +0 -1
  557. data/lib/facet/range.rb +0 -1
  558. data/lib/facet/regexp.rb +0 -1
  559. data/lib/facet/string.rb +0 -1
  560. data/lib/facet/symbol.rb +0 -1
  561. data/lib/facet/time.rb +0 -1
  562. data/lib/facet/unboundmethod.rb +0 -1
  563. data/lib/facets/core/array.rb +0 -35
  564. data/lib/facets/core/class.rb +0 -11
  565. data/lib/facets/core/comparable.rb +0 -5
  566. data/lib/facets/core/continuation.rb +0 -1
  567. data/lib/facets/core/date.rb +0 -6
  568. data/lib/facets/core/dir.rb +0 -4
  569. data/lib/facets/core/enumerable.rb +0 -42
  570. data/lib/facets/core/file.rb +0 -8
  571. data/lib/facets/core/fileutils.rb +0 -8
  572. data/lib/facets/core/float.rb +0 -4
  573. data/lib/facets/core/gem.rb +0 -4
  574. data/lib/facets/core/hash.rb +0 -40
  575. data/lib/facets/core/integer.rb +0 -9
  576. data/lib/facets/core/kernel.rb +0 -69
  577. data/lib/facets/core/logger.rb +0 -2
  578. data/lib/facets/core/matchdata.rb +0 -3
  579. data/lib/facets/core/module.rb +0 -43
  580. data/lib/facets/core/nilclass.rb +0 -9
  581. data/lib/facets/core/numeric.rb +0 -6
  582. data/lib/facets/core/pathname.rb +0 -2
  583. data/lib/facets/core/proc.rb +0 -3
  584. data/lib/facets/core/range.rb +0 -4
  585. data/lib/facets/core/regexp.rb +0 -3
  586. data/lib/facets/core/string.rb +0 -91
  587. data/lib/facets/core/symbol.rb +0 -13
  588. data/lib/facets/core/time.rb +0 -8
  589. data/lib/facets/core/unboundmethod.rb +0 -1
@@ -1,40 +1,27 @@
1
- #--
2
- # StateParser
1
+ # = stateparser.rb
3
2
  #
4
- # Copyright (c) 2005 Thomas Sawyer
3
+ # == Copyright (c) 2005 Thomas Sawyer
5
4
  #
6
- # Ruby License
5
+ # Ruby License
7
6
  #
8
- # This module is free software. You may use, modify, and/or redistribute this
9
- # software under the same terms as Ruby.
7
+ # This module is free software. You may use, modify, and/or redistribute this
8
+ # software under the same terms as Ruby.
10
9
  #
11
- # This program is distributed in the hope that it will be useful, but WITHOUT
12
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
- # FOR A PARTICULAR PURPOSE.
10
+ # This program is distributed in the hope that it will be useful, but WITHOUT
11
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
+ # FOR A PARTICULAR PURPOSE.
14
13
  #
15
- # ==========================================================================
16
- # Revision History
17
- # ==========================================================================
18
- #
19
- # 5.6.05 v3.0 trans
20
- # * Third major rewrite. This improves the system substantially.
21
- #
22
- # 5.2.06 v2.0 trans
23
- # - Removed raw tokens. Raw text is now available to every regular
24
- # token, so the end application can decided how to treat it.
25
- #
26
- # 5.1.27 v1.0 trans
27
- # - Removed priority. Order of tokens when parser is initialized
28
- # now determines precedence.
29
- # - If first argument to Parser.new is not a kind of AbstractToken
30
- # it is assumed to be the reentrant parser, otherwise the parser
31
- # itself is considered the reentrant parser. Having this allows raw
32
- # tokens to parse embedded content (among other things).
14
+ # == Author(s)
33
15
  #
34
- # ==========================================================================
35
- #++
16
+ # * Thomas Sawyer
17
+
18
+ # Author:: Thomas Sawyer
19
+ # Copyright:: Copyright (c) 2005 Thomas Sawyer
20
+ # License:: Ruby License
36
21
 
37
- #:title: StateParser
22
+ require 'ostruct'
23
+
24
+ # = StateParser
38
25
  #
39
26
  # Gerenal purpose stack-based parser. Define custom tokens
40
27
  # and the parser will build a parse tree from them.
@@ -111,12 +98,16 @@
111
98
  # [Note: There are a few other subtilties to go over that I haven't yet
112
99
  # documented, primarily related to creating more elaborate custom tokens. TODO!]
113
100
  #
114
- # == Author(s)
101
+ # Removed raw tokens. Raw text is now available to every regular
102
+ # token, so the end application can decided how to treat it.
115
103
  #
116
- # * Thomas Sawyer
104
+ # Removed priority. Order of tokens when parser is initialized
105
+ # now determines precedence.
117
106
  #
118
-
119
- require 'ostruct'
107
+ # If first argument to Parser.new is not a kind of AbstractToken
108
+ # it is assumed to be the reentrant parser, otherwise the parser
109
+ # itself is considered the reentrant parser. Having this allows raw
110
+ # tokens to parse embedded content (among other things).
120
111
 
121
112
  class StateParser ; end
122
113
 
@@ -127,7 +118,6 @@ module StateParser::Constants
127
118
  ENDCALLBACK = "end_callback"
128
119
  end
129
120
 
130
-
131
121
  # StateMachine Class
132
122
 
133
123
  class StateMachine
@@ -1,29 +1,41 @@
1
- #--
2
- # StaticHash
1
+ # = statichash
3
2
  #
4
- # Copyright (c) 2005 Thomas Sawyer
3
+ # == Copyright (c) 2005 Thomas Sawyer, Gavin Kistner
5
4
  #
6
- # Ported from Gavin Kistner's WriteOnceHash in basiclibrary.rb
7
- # Copyright (c) 2004 Gavin Kistner
5
+ # Ruby License
8
6
  #
9
- # Reuse License
7
+ # This module is free software. You may use, modify, and/or redistribute this
8
+ # software under the same terms as Ruby.
9
+ #
10
+ # This program is distributed in the hope that it will be useful, but WITHOUT
11
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
+ # FOR A PARTICULAR PURPOSE.
13
+ #
14
+ # == SPECIAL THANKS
15
+ #
16
+ # Special thanks go to Gavin Kistner.
17
+ #
18
+ # StaticHash is based on WriteOnceHash in basiclibrary.rb,
19
+ # Copyright (c) 2004 by Gavin Kistner.
10
20
  #
11
21
  # It is covered under the license viewable at
22
+ #
12
23
  # http://phrogz.net/JS/_ReuseLicense.txt
24
+ #
13
25
  # Reuse or modification is free provided you abide by the terms of that
14
- # license. (Including the first two lines above in your source code
26
+ # license. (Including the first two lines above in your source code
15
27
  # usually satisfies the conditions.)
16
28
  #
17
- # ==========================================================================
18
- # Revision History
19
- # ==========================================================================
20
- #
21
- # 2004-06-01 Trans * Ported to Calibre
29
+ # == Author(s)
22
30
  #
23
- # ==========================================================================
24
- #++
31
+ # * Thomas Sawyer
32
+ # * Gavin Kistner
33
+
34
+ # Author:: Thomas Sawyer, Gavin Kistner
35
+ # Copyright:: Copyright (c) 2005 Thomas Sawyer, Gavin Kistner
36
+ # License:: Ruby License
25
37
 
26
- #:title: StaticHash
38
+ # = StaticHash
27
39
  #
28
40
  # A Hash object which raises an error if any
29
41
  # previously-defined key attempts to be set again.
@@ -40,10 +52,6 @@
40
52
  # Error: StaticHash has value for key 'name' in object:
41
53
  # {"name"=>"Tom", "age"=>30} (RuntimeError)
42
54
  #
43
- # == Author(s)
44
- #
45
- # * Gavin Kistner
46
- #
47
55
 
48
56
  class StaticHash < Hash
49
57
 
@@ -69,19 +77,19 @@ end
69
77
 
70
78
  =begin testing
71
79
 
72
- require 'test/unit'
80
+ require 'test/unit'
73
81
 
74
- class TC_StaticHash < Test::Unit::TestCase
82
+ class TC_StaticHash < Test::Unit::TestCase
75
83
 
76
- def setup
77
- @sh1 = StaticHash.new
78
- end
84
+ def setup
85
+ @sh1 = StaticHash.new
86
+ end
79
87
 
80
- def test_assign
81
- @sh1["x"] = 1
82
- assert_raises( ArgumentError ){ @sh1["x"] = 2 }
83
- end
88
+ def test_assign
89
+ @sh1["x"] = 1
90
+ assert_raises( ArgumentError ){ @sh1["x"] = 2 }
91
+ end
84
92
 
85
- end
93
+ end
86
94
 
87
95
  =end
@@ -1,39 +1,31 @@
1
- #--
2
- # SyncArray
1
+ # = syncarray.rb
3
2
  #
4
- # Copyright (c) 2004-2005 Navel, all rights reserved.
3
+ # == Copyright (c) 2004 Navel
5
4
  #
6
- # Ruby License
5
+ # Ruby License
7
6
  #
8
- # This module is free software. You may use, modify, and/or redistribute this
9
- # software under the same terms as Ruby.
7
+ # This module is free software. You may use, modify, and/or redistribute this
8
+ # software under the same terms as Ruby.
10
9
  #
11
- # This program is distributed in the hope that it will be useful, but WITHOUT
12
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
- # FOR A PARTICULAR PURPOSE.
10
+ # This program is distributed in the hope that it will be useful, but WITHOUT
11
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
+ # FOR A PARTICULAR PURPOSE.
14
13
  #
15
- # ==========================================================================
16
- # Revision History
17
- # ==========================================================================
18
- # 2005.08.07 trans Ported to Mega Modules
19
- # ==========================================================================
20
- #++
14
+ # == Author(s)
15
+ #
16
+ # * George Moschovitis
17
+
18
+ # Author:: George Moschovitis <gm@navel.gr>
19
+ # Copyright:: Copyright (c) 2005 Navel
20
+ # License:: Ruby License
21
+
22
+ require 'sync'
21
23
 
22
- #:title: SyncArray
24
+ # = SyncArray
23
25
  #
24
26
  # A thread-safe array. We use a sync object instead of a
25
27
  # mutex, because it is re-entrant. An exclusive lock is
26
28
  # needed when writing, a shared lock IS NEEDED when reading.
27
- #
28
- # == Usage
29
- #
30
- # TODO
31
- #
32
- # == Author(s)
33
- #
34
- # * George Moschovitis <gm@navel.gr>
35
-
36
- require 'sync'
37
29
 
38
30
  class Array
39
31
 
@@ -1,29 +1,25 @@
1
- #--
2
- # SyncHash
3
- #
4
- # Copyright (c) 2004-2005 Navel, all rights reserved.
5
- #
6
- # Ruby License
1
+ # = synchash.rb
7
2
  #
8
- # This module is free software. You may use, modify, and/or redistribute this
9
- # software under the same terms as Ruby.
3
+ # == Copyright (c) 2004 Navel
10
4
  #
11
- # This program is distributed in the hope that it will be useful, but WITHOUT
12
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
- # FOR A PARTICULAR PURPOSE.
5
+ # Ruby License
14
6
  #
15
- # ==========================================================================
16
- # Revision History
17
- # ==========================================================================
7
+ # This module is free software. You may use, modify, and/or redistribute this
8
+ # software under the same terms as Ruby.
18
9
  #
19
- # 05.08.23 trans United Inherited and Delegated forms in a single class.
10
+ # This program is distributed in the hope that it will be useful, but WITHOUT
11
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
+ # FOR A PARTICULAR PURPOSE.
20
13
  #
21
- # 05.08.07 trans Ported to Mega from Glue.
14
+ # == Author(s)
22
15
  #
23
- # ==========================================================================
24
- #++
16
+ # * George Moschovitis
25
17
 
26
- #:title: SyncHash
18
+ # Author:: George Moschovitis <gm@navel.gr>
19
+ # Copyright:: Copyright (c) 2005 Navel
20
+ # License:: Ruby License
21
+
22
+ # = SyncHash
27
23
  #
28
24
  # A thread-safe hash. We use a sync object instead of a mutex,
29
25
  # because it is re-entrant. An exclusive lock is needed when
@@ -41,13 +37,8 @@
41
37
  #
42
38
  # == Usage
43
39
  #
44
- # hash = SyncHash.new
45
- # hash = SyncHash.new(Hash.new) # Delegates
46
- #
47
- # ==Author(s)
48
- #
49
- # * George Moschovitis
50
- # * Thomas Sawyer
40
+ # hash = SyncHash.new
41
+ # hash = SyncHash.new(Hash.new) # Delegates
51
42
  #
52
43
 
53
44
  require 'sync'
@@ -1,30 +1,38 @@
1
- #--
2
- # System
1
+ # = system.rb
3
2
  #
4
- # Copyright (c) 2005 Thomas Sawyer
3
+ # == Copyright (c) 2005 Thomas Sawyer, Minero Aoki
4
+ #
5
+ # Ruby License
6
+ #
7
+ # This module is free software. You may use, modify, and/or redistribute this
8
+ # software under the same terms as Ruby.
9
+ #
10
+ # This program is distributed in the hope that it will be useful, but WITHOUT
11
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
+ # FOR A PARTICULAR PURPOSE.
13
+ #
14
+ # == Special Thanks
5
15
  #
6
16
  # Adapted from RubyParams module by Minero Aoki
7
17
  # Copyright (c) 1999-2002 Minero Aoki <aamine@loveruby.net>
8
18
  #
9
- # This program is free software.
10
- # You can distribute/modify this program under the terms of
11
- # the GNU Lesser General Public License version 2 or later.
12
- #
13
- # =============================================================
14
- # Revision History
15
- # =============================================================
16
- # 2005-11-29 trans * Pieced together.
17
- # =============================================================
18
- #++
19
+ # == Author(s)
20
+ #
21
+ # * Thomas Sawyer
22
+ # * Minero Aoki
23
+
24
+ # Author:: Thomas Sawyer, Minero Aoki
25
+ # Copyright:: Copyright (c) 2005 Thomas Sawyer, Minero Aoki
26
+ # License:: Ruby License
19
27
 
20
28
  require 'rbconfig'
21
29
 
22
- # :title: System
30
+ # = System
23
31
  #
24
- # The System module provides Platform and Ruby system info.
32
+ # The System module provides Platform and Ruby system information.
33
+ # The module should also be able to stand in for rbconfig.
25
34
  # It is intended for use as a service module although it
26
- # can be mixed too.
27
- #
35
+ # can be mixed-in too.
28
36
 
29
37
  module System
30
38
 
@@ -1,45 +1,25 @@
1
- #--
2
- # TagIterator (aka Tagiter)
1
+ # = tagiterator.rb
3
2
  #
4
- # Copyright (c) 2000 Ⴗnyasu <nyasu@osk.3web.ne.jp>
3
+ # == Copyright (c) 2000 Ⴗnyasu <nyasu@osk.3web.ne.jp>
5
4
  #
6
- # Ruby License
5
+ # Ruby License
7
6
  #
8
- # This module is free software. You may use, modify, and/or redistribute this
9
- # software under the same terms as Ruby.
7
+ # This module is free software. You may use, modify, and/or redistribute this
8
+ # software under the same terms as Ruby.
10
9
  #
11
- # This program is distributed in the hope that it will be useful, but WITHOUT
12
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
- # FOR A PARTICULAR PURPOSE.
10
+ # This program is distributed in the hope that it will be useful, but WITHOUT
11
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
+ # FOR A PARTICULAR PURPOSE.
14
13
  #
15
- # ==========================================================================
16
- # Revision History
17
- # ==========================================================================
18
- #
19
- # 04.11.30 trans Added to Calibre and renamed TagIterator.
20
- #
21
- # 03.09.18 nyasu Made attribute name case-ignored.
22
- #
23
- # 03.06.06 nyasu Added a new method : nth_trailer(tag,n).
24
- # Fixed regexp of tagnext method.
25
- #
26
- # 03.06.05 nyasu Added new methods for information, #tagexist?(tag) and
27
- # tagnext. Fixed bugs on return values of each_block
28
- #
29
- # 03.06.01 nyasu Fixed nth method which sometimes crashes at the
30
- # end-of-file. (reported by Matsui-san)
31
- #
32
- # 03.05.08 nyasu Fixed enumtag which yields only half of texts in
33
- # some conditions.
34
- #
35
- # 02.04.27 nyasu Regexp debugged in parse_attribute
36
- #
37
- # 02.03.12 nyasu Started
14
+ # == Author(s)
38
15
  #
39
- # ==========================================================================
40
- #++
16
+ # * Ⴗnyasu
17
+
18
+ # Author:: Ⴗnyasu <nyasu@osk.3web.ne.jp>
19
+ # Copyright:: Copyright (c) 2000 Ⴗnyasu
20
+ # License:: Ruby License
41
21
 
42
- #:title: TagIterator
22
+ # = TagIterator (aka Tagiter)
43
23
  #
44
24
  # Simple but very useful HTML/XHTML cascading parser.
45
25
  #
@@ -124,10 +104,6 @@
124
104
  # S1
125
105
  # S2
126
106
  #
127
- # == Author(s)
128
- #
129
- # *ɂႷ nyasu <nyasu[at]osk.3web.ne.jp>
130
- #
131
107
 
132
108
  class TagIterator
133
109
 
@@ -0,0 +1,417 @@
1
+ # = taskable.rb
2
+ #
3
+ # == Copyright (c) 2006 Thomas Sawyer
4
+ #
5
+ # Ruby License
6
+ #
7
+ # This module is free software. You may use, modify, and/or redistribute this
8
+ # software under the same terms as Ruby.
9
+ #
10
+ # This program is distributed in the hope that it will be useful, but WITHOUT
11
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
+ # FOR A PARTICULAR PURPOSE.
13
+ #
14
+ # == Auhtor(s)
15
+ #
16
+ # * Thomas Sawyer
17
+
18
+ # Author:: Thomas Sawyer
19
+ # Copyright:: Copyright (c) 2006 Thomas Sawyer
20
+ # License:: Ruby License
21
+
22
+ require 'tsort'
23
+ require 'facets/core/kernel/cache.rb'
24
+ require 'facets/core/kernel/method.rb'
25
+ require 'facets/more/inheritor.rb'
26
+
27
+ # = TSort
28
+ #
29
+ # TSort is used to determine which prerequisites to run
30
+ # for a task.
31
+ #
32
+ # Here we add a convenience method --if such a long method
33
+ # name can be said to be convenient ;) Although we ended
34
+ # not using it after all --it still may proved useful and
35
+ # may eventually be added to Facets or submitted as a patch.
36
+
37
+ module TSort
38
+ def strongly_connected_components_from(node)
39
+ result = []
40
+ each_strongly_connected_component_from(node) do |component|
41
+ result << component
42
+ end
43
+ result
44
+ end
45
+ end
46
+
47
+ # = Task
48
+ #
49
+ # A Task is a Method with prerequisite dependencies.
50
+ #
51
+ # NOTE Can't subclass Method b/c Method has no initiator.
52
+ # Not sure that would be a good idea anyway.
53
+
54
+ class Task
55
+ attr_accessor :description
56
+
57
+ def initialize( name, container, preq, desc=nil, &action )
58
+ @name = name
59
+ @container = container
60
+ @prerequisite = preq || []
61
+ @description = desc
62
+ @action = action
63
+ end
64
+
65
+ def prerequisite
66
+ @prerequisite ||= []
67
+ end
68
+
69
+ # #--
70
+ # # TODO Problem is 'a' can't take any parameters,
71
+ # # and there's no way to sort the tasks
72
+ # # from here. FIX if possible.
73
+ # #++
74
+ # def to_proc
75
+ # r = @prerequisite
76
+ # n = @name
77
+ # a = @action
78
+ # lambda {
79
+ # r.each{ |d| send(d) unless n == d }
80
+ # instance_eval &a if a
81
+ # }
82
+ # end
83
+
84
+ def complete
85
+ # ensure no cycles in the graph and extract call graph
86
+ #own = (class << self; self; end) # in case there are singletons?
87
+ t = Graph.new( container, name )
88
+ t.each_strongly_connected_component_from( name ) { |c|
89
+ #@container.instance_task(c).call
90
+ @container.send("->#{d}")
91
+ }
92
+ end
93
+
94
+ def call
95
+ @action.call
96
+ end
97
+
98
+ def each(&blk)
99
+ @prerequisite.each(&blk)
100
+ end
101
+
102
+ # Task::Graph is a Tarjan-sorted hash.
103
+ # It is used to generate the proper dependency chains.
104
+ # TODO Make Multiton off of base.
105
+
106
+ class Graph < Hash
107
+ include TSort
108
+
109
+ def initialize( base, name )
110
+ @base = base.class
111
+ @name = name
112
+ instance_map( name )
113
+ end
114
+
115
+ def instance_map( name )
116
+ t = @base.instance_task(name)
117
+ raise "prerequired task does not exist -- #{name} in #{@base}" unless t
118
+ self[name] = t.prerequisite || []
119
+ self[name].each { |r| instance_map( r ) }
120
+ end
121
+
122
+ alias_method :tsort_each_node, :each_key
123
+
124
+ def tsort_each_child(node, &block)
125
+ fetch(node).each(&block)
126
+ end
127
+ end
128
+
129
+ end
130
+
131
+ # = Taskable
132
+ #
133
+ # The Taskable module provides a generic task system
134
+ # patterned after Rake, but useable in any
135
+ # code context --not just with the Rake tool. In other
136
+ # words one can create methods with dependencies.
137
+ #
138
+ # NOTE Unlike methods, tasks can't take parameters
139
+ # if they are to be used as prerequisites.
140
+ # This capability might be added in the future, but
141
+ # presently syntax limitations make it awkward.
142
+
143
+ module Taskable
144
+
145
+ # Provide a mapping of tasks, including task from ancestors.
146
+ # TODO Not sure this is properly reading from ancestors.
147
+
148
+ # Define description for subsequent task.
149
+
150
+ def desc(line=nil)
151
+ return @last_description unless line
152
+ @last_description = line.gsub("\n",'')
153
+ end
154
+
155
+ # Use a description for subsequent task.
156
+
157
+ def desc!
158
+ l = @last_description
159
+ @last_description = nil
160
+ l
161
+ end
162
+
163
+ # Access a task.
164
+
165
+ def instance_task( name )
166
+ instance_task_table[ name.to_sym ]
167
+ end
168
+
169
+ # List of task names.
170
+
171
+ def instance_tasks
172
+ instance_task_table.keys
173
+ # t = instance_methods(true).select{ |m| m =~ /^->/ }
174
+ # t.collect { |e| e[2..-1].to_sym }
175
+ end
176
+
177
+ # List of task names with descriptions.
178
+
179
+ def described_tasks
180
+ instance_tasks.select { |name| instance_task(name).description }
181
+ end
182
+
183
+ # List of task names without descriptions.
184
+
185
+ def undescribed_tasks
186
+ instance_tasks.select { |name| ! instance_task(name).description }
187
+ end
188
+
189
+ # Define a task.
190
+
191
+ def task(args, &action)
192
+ if Hash === args
193
+ raise ArgumentError, "#{args.size} for 1" if args.size != 1
194
+ name, *deps = *(args.to_a.flatten)
195
+ name = name.to_sym
196
+ deps = deps.compact.collect{ |e| e.to_sym }
197
+ else
198
+ name, deps = args.to_sym, []
199
+ end
200
+ # create task via create core and callable methods.
201
+ # We do it this way b/c otherwise we'd have to use
202
+ # instance_eval and then can't ever pass paramaters.
203
+ if action
204
+ define_method( "->#{name}", &action ) # core of the task
205
+ define_method( name ) do
206
+ # ensure no cycles in the graph and extract call graph
207
+ #own = (class << self; self; end) # in case there are singletons?
208
+ todolist = Task::Graph.new( self, name )
209
+ todolist.each_strongly_connected_component_from( name ) do |c|
210
+ send("->#{c}")
211
+ end
212
+ end
213
+ instance_task_table![name] = Task.new( name, self, deps, desc!, &action )
214
+ else
215
+ m = instance_task_table![name]
216
+ #m.description = desc! # TODO should this apply only if there is an action?
217
+ m.prerequisite.concat deps unless deps.empty?
218
+ m
219
+ end
220
+ end
221
+
222
+ # Include the Task module into the Module class.
223
+
224
+ class ::Module
225
+ include Taskable
226
+ # This has to be down here and not in Taskable b/c of
227
+ # a glitch in inheritor's design.
228
+ inheritor :instance_task_table, {}, :merge
229
+ end
230
+
231
+ end
232
+
233
+ #
234
+
235
+ class Object
236
+ def send_task( name )
237
+ (class << self; self; end).instance_task( name )
238
+ end
239
+ end
240
+
241
+ #--
242
+ # TODO Allows tasks to defined at the toplevel (main).
243
+ # This may need work b/c it might cause an infinite loop.
244
+ # Plus there are a few method missing yet. Anyway,
245
+ # I'm not needing this functionality at the moment, and
246
+ # I leave it to somone else to finish when they do.
247
+ #
248
+ # class Object
249
+ #
250
+ # def instance_tasks
251
+ # (class << self; self; end).instance_tasks
252
+ # end
253
+ #
254
+ # def instance_task(*args, &blk)
255
+ # (class << self; self; end).task(*args, &blk)
256
+ # end
257
+ #
258
+ # def desc(*args, &blk)
259
+ # (class << self; self; end).desc(*args, &blk)
260
+ # end
261
+ #
262
+ # def desc!(*args, &blk)
263
+ # (class << self; self; end).desc!(*args, &blk)
264
+ # end
265
+ #
266
+ # def task(*args, &blk)
267
+ # (class << self; self; end).desc(*args, &blk)
268
+ # end
269
+ #
270
+ # end
271
+ #++
272
+
273
+
274
+ # _____ _
275
+ # |_ _|__ ___| |_
276
+ # | |/ _ \/ __| __|
277
+ # | | __/\__ \ |_
278
+ # |_|\___||___/\__|
279
+ #
280
+ =begin test
281
+
282
+ require 'test/unit'
283
+
284
+ class TCTask < Test::Unit::TestCase
285
+
286
+ module M
287
+ task :m1 => [ :c1 ] do @x << "m1" end
288
+ task :m2 => [ :c2 ] do @x << "m2" end
289
+ task :m3 => [ :c3 ] do @x << "m3" end
290
+ task :m4 => [ :c1, :c2, :c3 ] do @x << "m4" end
291
+ task :m5 do @x << 'm5' end
292
+ end
293
+
294
+ class C
295
+ include M
296
+ attr :x
297
+ def initialize ; @x = [] ; end
298
+
299
+ task :c1 do @x << "c1" end
300
+ task :c2 => [ :c1, :c1 ] do @x << "c2" end
301
+ task :c3 => [ :c1, :c2 ] do @x << "c3" end
302
+ task :c4 => [ :m1 ] do @x << "c4" end
303
+ task :c5 => [ :c5 ] do @x << "c5" end
304
+ task :c6 => [ :c7 ] do @x << "c6" end
305
+ task :c7 => [ :c6 ] do @x << "c7" end
306
+ end
307
+
308
+ class D < C
309
+ task :d1 => [ :c1 ] do @x << "d1" ; end
310
+ task :d2 => [ :m1 ] do @x << "d2" ; end
311
+ end
312
+
313
+ module N
314
+ include M
315
+ end
316
+
317
+ class E
318
+ include N
319
+ attr :x
320
+ def initialize ; @x = [] ; end
321
+
322
+ task :e1 => [ :c1 ] do @x << "e1" ; end
323
+ task :e2 => [ :m1 ] do @x << "e2" ; end
324
+ task :e3 => [ :m5 ] do @x << "e3" ; end
325
+ end
326
+
327
+ module O
328
+ attr :x
329
+ task :o1 do (@x||=[]) << "o1" end
330
+ task :o2 => [ :o1 ] do (@x||=[]) << "o2" end
331
+ end
332
+
333
+ # TODO Appearently extending does play well with inheritor?
334
+ # F = Module.new { extend O }
335
+
336
+ # tests
337
+
338
+ def test_C1
339
+ c = C.new ; c.c1
340
+ assert_equal( [ 'c1' ], c.x )
341
+ end
342
+
343
+ def test_C2
344
+ c = C.new ; c.c2
345
+ assert_equal( [ 'c1', 'c2' ], c.x )
346
+ end
347
+
348
+ def test_C3
349
+ c = C.new ; c.c3
350
+ assert_equal( [ 'c1', 'c2', 'c3' ], c.x )
351
+ end
352
+
353
+ def test_C4
354
+ c = C.new ; c.c4
355
+ assert_equal( [ 'c1', 'm1', 'c4' ], c.x )
356
+ end
357
+
358
+ def test_M1
359
+ c = C.new ; c.m1
360
+ assert_equal( [ 'c1', 'm1' ], c.x )
361
+ end
362
+
363
+ def test_M2
364
+ c = C.new ; c.m2
365
+ assert_equal( [ 'c1', 'c2', 'm2' ], c.x )
366
+ end
367
+
368
+ def test_M3
369
+ c = C.new ; c.m3
370
+ assert_equal( [ 'c1', 'c2', 'c3', 'm3' ], c.x )
371
+ end
372
+
373
+ def test_M4
374
+ c = C.new ; c.m4
375
+ assert_equal( [ 'c1', 'c2', 'c3', 'm4' ], c.x )
376
+ end
377
+
378
+ def test_D1
379
+ d = D.new ; d.d1
380
+ assert_equal( [ 'c1', 'd1' ], d.x )
381
+ end
382
+
383
+ def test_D2
384
+ d = D.new ; d.d2
385
+ assert_equal( [ 'c1', 'm1', 'd2' ], d.x )
386
+ end
387
+
388
+ def test_E1
389
+ e = E.new
390
+ assert_raises( RuntimeError ) { e.e1 }
391
+ #assert_equal( [ 'c1', 'e1' ], e.x )
392
+ end
393
+
394
+ def test_E2
395
+ e = E.new
396
+ assert_raises( RuntimeError ) { e.e2 }
397
+ #assert_equal( [ 'c1', 'm1', 'e2' ], e.x )
398
+ end
399
+
400
+ def test_E3
401
+ e = E.new ; e.e3
402
+ assert_equal( [ 'm5', 'e3' ], e.x )
403
+ end
404
+
405
+ # def test_F1
406
+ # F.o1
407
+ # assert_equal( [ 'o1' ], F.x )
408
+ # end
409
+ #
410
+ # def test_F2
411
+ # F.o2
412
+ # assert_equal( [ 'o1', 'o1', 'o2' ], F.x )
413
+ # end
414
+
415
+ end
416
+
417
+ =end