facets 1.7.38 → 1.7.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (403) hide show
  1. data/README +17 -6
  2. data/VERSION +1 -1
  3. data/doc/CHANGELOG +8 -0
  4. data/lib/facet/array/combos.rb +1 -0
  5. data/lib/facet/array/each_combo.rb +1 -0
  6. data/lib/facet/enumerable/permutation.rb +1 -0
  7. data/lib/facet/enumerable/sum.rb +1 -0
  8. data/lib/facet/linkedlist.rb +1 -0
  9. data/lib/facet/pathname/op_div.rb +1 -0
  10. data/lib/facets/core/array/combos.rb +3 -0
  11. data/lib/facets/core/array/each_combo.rb +48 -0
  12. data/lib/facets/core/enumerable/{permute.rb → permutation.rb} +8 -1
  13. data/lib/facets/core/enumerable/self/combinations.rb +13 -8
  14. data/lib/facets/core/enumerable/sum.rb +19 -0
  15. data/lib/facets/core/pathname/op_div.rb +4 -0
  16. data/lib/facets/more/annotation.rb +10 -0
  17. data/lib/facets/more/linkedlist.rb +254 -0
  18. data/test/lib/facets/core/array/test_at_rand.rb +1 -1
  19. data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
  20. data/test/lib/facets/core/array/test_delete_values.rb +1 -1
  21. data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
  22. data/test/lib/facets/core/array/test_first.rb +1 -1
  23. data/test/lib/facets/core/array/test_head.rb +1 -1
  24. data/test/lib/facets/core/array/test_last_index.rb +1 -1
  25. data/test/lib/facets/core/array/test_merge.rb +1 -1
  26. data/test/lib/facets/core/array/test_mid.rb +1 -1
  27. data/test/lib/facets/core/array/test_middle.rb +1 -1
  28. data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
  29. data/test/lib/facets/core/array/test_pick.rb +1 -1
  30. data/test/lib/facets/core/array/test_pos.rb +1 -1
  31. data/test/lib/facets/core/array/test_pot.rb +1 -1
  32. data/test/lib/facets/core/array/test_pull.rb +1 -1
  33. data/test/lib/facets/core/array/test_rand_index.rb +1 -1
  34. data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
  35. data/test/lib/facets/core/array/test_range.rb +1 -1
  36. data/test/lib/facets/core/array/test_rotate.rb +1 -1
  37. data/test/lib/facets/core/array/test_select.rb +1 -1
  38. data/test/lib/facets/core/array/test_shuffle.rb +1 -1
  39. data/test/lib/facets/core/array/test_thru.rb +1 -1
  40. data/test/lib/facets/core/array/test_to_b.rb +1 -1
  41. data/test/lib/facets/core/array/test_to_h.rb +1 -1
  42. data/test/lib/facets/core/array/test_to_hash.rb +1 -1
  43. data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
  44. data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
  45. data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
  46. data/test/lib/facets/core/binding/test_called.rb +1 -1
  47. data/test/lib/facets/core/binding/test_caller.rb +1 -1
  48. data/test/lib/facets/core/binding/test_defined.rb +1 -1
  49. data/test/lib/facets/core/binding/test_eval.rb +1 -1
  50. data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
  51. data/test/lib/facets/core/binding/test_method_name.rb +1 -1
  52. data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
  53. data/test/lib/facets/core/binding/test_op_store.rb +1 -1
  54. data/test/lib/facets/core/binding/test_self.rb +1 -1
  55. data/test/lib/facets/core/class/test_cattr.rb +1 -1
  56. data/test/lib/facets/core/class/test_descendents.rb +1 -1
  57. data/test/lib/facets/core/class/test_method_name.rb +1 -1
  58. data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
  59. data/test/lib/facets/core/class/test_unix_path.rb +1 -1
  60. data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
  61. data/test/lib/facets/core/comparable/test_clip.rb +1 -1
  62. data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
  63. data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
  64. data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
  65. data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
  66. data/test/lib/facets/core/date/test_stamp.rb +1 -1
  67. data/test/lib/facets/core/date/test_to_date.rb +1 -1
  68. data/test/lib/facets/core/date/test_to_s.rb +1 -1
  69. data/test/lib/facets/core/date/test_to_time.rb +1 -1
  70. data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
  71. data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
  72. data/test/lib/facets/core/enumerable/self/test_combinations.rb +11 -8
  73. data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
  74. data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
  75. data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
  76. data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
  77. data/test/lib/facets/core/enumerable/test_count.rb +1 -1
  78. data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
  79. data/test/lib/facets/core/enumerable/test_each_by.rb +1 -1
  80. data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
  81. data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
  82. data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
  83. data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
  84. data/test/lib/facets/core/enumerable/test_eachn.rb +1 -1
  85. data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
  86. data/test/lib/facets/core/enumerable/test_every.rb +1 -1
  87. data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
  88. data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
  89. data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
  90. data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
  91. data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
  92. data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
  93. data/test/lib/facets/core/enumerable/test_none.rb +1 -1
  94. data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
  95. data/test/lib/facets/core/enumerable/test_one.rb +1 -1
  96. data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
  97. data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
  98. data/test/lib/facets/core/enumerable/test_permutation.rb +29 -0
  99. data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
  100. data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
  101. data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
  102. data/test/lib/facets/core/file/self/test_create.rb +1 -1
  103. data/test/lib/facets/core/file/self/test_open_as_string.rb +1 -1
  104. data/test/lib/facets/core/file/self/test_read_list.rb +1 -1
  105. data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
  106. data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
  107. data/test/lib/facets/core/float/test_round_at.rb +1 -1
  108. data/test/lib/facets/core/float/test_round_to.rb +1 -1
  109. data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
  110. data/test/lib/facets/core/hash/test_alias.rb +1 -1
  111. data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
  112. data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
  113. data/test/lib/facets/core/hash/test_at.rb +1 -1
  114. data/test/lib/facets/core/hash/test_collate.rb +1 -1
  115. data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
  116. data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
  117. data/test/lib/facets/core/hash/test_graph.rb +1 -1
  118. data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
  119. data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
  120. data/test/lib/facets/core/hash/test_inverse.rb +1 -1
  121. data/test/lib/facets/core/hash/test_normalize_keys.rb +1 -1
  122. data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
  123. data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
  124. data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
  125. data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
  126. data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
  127. data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
  128. data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
  129. data/test/lib/facets/core/hash/test_slice.rb +1 -1
  130. data/test/lib/facets/core/hash/test_stringify_keys.rb +1 -1
  131. data/test/lib/facets/core/hash/test_swap.rb +1 -1
  132. data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
  133. data/test/lib/facets/core/hash/test_symbolize_keys.rb +1 -1
  134. data/test/lib/facets/core/hash/test_to_h.rb +1 -1
  135. data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
  136. data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
  137. data/test/lib/facets/core/hash/test_traverse.rb +1 -1
  138. data/test/lib/facets/core/hash/test_update_each.rb +1 -1
  139. data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
  140. data/test/lib/facets/core/hash/test_update_values.rb +1 -1
  141. data/test/lib/facets/core/hash/test_weave.rb +1 -1
  142. data/test/lib/facets/core/integer/test_factorial.rb +1 -1
  143. data/test/lib/facets/core/integer/test_multiple.rb +1 -1
  144. data/test/lib/facets/core/integer/test_of.rb +1 -1
  145. data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
  146. data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
  147. data/test/lib/facets/core/kernel/test___class__.rb +1 -1
  148. data/test/lib/facets/core/kernel/test_as.rb +1 -1
  149. data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
  150. data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
  151. data/test/lib/facets/core/kernel/test_bool.rb +1 -1
  152. data/test/lib/facets/core/kernel/test_bug.rb +1 -1
  153. data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
  154. data/test/lib/facets/core/kernel/test_called.rb +1 -1
  155. data/test/lib/facets/core/kernel/test_callee.rb +1 -1
  156. data/test/lib/facets/core/kernel/test_constant.rb +1 -1
  157. data/test/lib/facets/core/kernel/test_copy.rb +1 -1
  158. data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
  159. data/test/lib/facets/core/kernel/test_demo.rb +1 -1
  160. data/test/lib/facets/core/kernel/test_fn.rb +1 -1
  161. data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
  162. data/test/lib/facets/core/kernel/test_here.rb +1 -1
  163. data/test/lib/facets/core/kernel/test_in.rb +1 -1
  164. data/test/lib/facets/core/kernel/test_instance_exec.rb +1 -1
  165. data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
  166. data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
  167. data/test/lib/facets/core/kernel/test_method.rb +1 -1
  168. data/test/lib/facets/core/kernel/test_methods.rb +1 -1
  169. data/test/lib/facets/core/kernel/test_new.rb +1 -1
  170. data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
  171. data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
  172. data/test/lib/facets/core/kernel/test_quaclass.rb +1 -1
  173. data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
  174. data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
  175. data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
  176. data/test/lib/facets/core/kernel/test_resc.rb +1 -1
  177. data/test/lib/facets/core/kernel/test_returning.rb +1 -1
  178. data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
  179. data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
  180. data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
  181. data/test/lib/facets/core/kernel/test_silently.rb +1 -1
  182. data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
  183. data/test/lib/facets/core/kernel/test_singleton_class.rb +1 -1
  184. data/test/lib/facets/core/kernel/test_superior.rb +1 -1
  185. data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
  186. data/test/lib/facets/core/kernel/test_this.rb +1 -1
  187. data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
  188. data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
  189. data/test/lib/facets/core/kernel/test_to_data.rb +1 -1
  190. data/test/lib/facets/core/kernel/test_uri.rb +1 -1
  191. data/test/lib/facets/core/kernel/test_val.rb +1 -1
  192. data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
  193. data/test/lib/facets/core/matchdata/test_match.rb +1 -1
  194. data/test/lib/facets/core/matchdata/test_matchtree.rb +1 -1
  195. data/test/lib/facets/core/module/self/test_op_add.rb +1 -1
  196. data/test/lib/facets/core/module/test_abstract.rb +1 -1
  197. data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
  198. data/test/lib/facets/core/module/test_ancestor.rb +1 -1
  199. data/test/lib/facets/core/module/test_basename.rb +1 -1
  200. data/test/lib/facets/core/module/test_by_name.rb +1 -1
  201. data/test/lib/facets/core/module/test_class_extension.rb +1 -1
  202. data/test/lib/facets/core/module/test_clone_using.rb +1 -1
  203. data/test/lib/facets/core/module/test_dirname.rb +1 -1
  204. data/test/lib/facets/core/module/test_equate_on.rb +1 -1
  205. data/test/lib/facets/core/module/test_include_as.rb +1 -1
  206. data/test/lib/facets/core/module/test_initializer.rb +1 -1
  207. data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
  208. data/test/lib/facets/core/module/test_integrate.rb +1 -1
  209. data/test/lib/facets/core/module/test_memoize.rb +1 -1
  210. data/test/lib/facets/core/module/test_modspace.rb +1 -1
  211. data/test/lib/facets/core/module/test_namespace.rb +1 -1
  212. data/test/lib/facets/core/module/test_nesting.rb +1 -1
  213. data/test/lib/facets/core/module/test_nodef.rb +1 -1
  214. data/test/lib/facets/core/module/test_on_included.rb +1 -1
  215. data/test/lib/facets/core/module/test_redef.rb +1 -1
  216. data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
  217. data/test/lib/facets/core/module/test_redirect.rb +1 -1
  218. data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
  219. data/test/lib/facets/core/module/test_remove.rb +1 -1
  220. data/test/lib/facets/core/module/test_rename.rb +1 -1
  221. data/test/lib/facets/core/module/test_rename_method.rb +1 -1
  222. data/test/lib/facets/core/module/test_revisal.rb +1 -1
  223. data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
  224. data/test/lib/facets/core/module/test_sort_on.rb +1 -1
  225. data/test/lib/facets/core/module/test_this.rb +1 -1
  226. data/test/lib/facets/core/module/test_wrap.rb +1 -1
  227. data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
  228. data/test/lib/facets/core/nilclass/test_blank.rb +1 -1
  229. data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
  230. data/test/lib/facets/core/nilclass/test_include.rb +1 -1
  231. data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
  232. data/test/lib/facets/core/nilclass/test_size.rb +1 -1
  233. data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
  234. data/test/lib/facets/core/numeric/test_approx.rb +1 -1
  235. data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
  236. data/test/lib/facets/core/numeric/test_distance.rb +1 -1
  237. data/test/lib/facets/core/numeric/test_succ.rb +1 -1
  238. data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
  239. data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
  240. data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
  241. data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
  242. data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
  243. data/test/lib/facets/core/proc/test_compose.rb +1 -1
  244. data/test/lib/facets/core/proc/test_op_mul.rb +1 -1
  245. data/test/lib/facets/core/proc/test_to_method.rb +1 -1
  246. data/test/lib/facets/core/range/test_to_r.rb +1 -1
  247. data/test/lib/facets/core/range/test_to_range.rb +1 -1
  248. data/test/lib/facets/core/range/test_umbrella.rb +1 -1
  249. data/test/lib/facets/core/range/test_within.rb +1 -1
  250. data/test/lib/facets/core/regexp/test_arity.rb +1 -1
  251. data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
  252. data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
  253. data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
  254. data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
  255. data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
  256. data/test/lib/facets/core/string/test_align_center.rb +1 -1
  257. data/test/lib/facets/core/string/test_at_rand.rb +1 -1
  258. data/test/lib/facets/core/string/test_basename.rb +1 -1
  259. data/test/lib/facets/core/string/test_blank.rb +1 -1
  260. data/test/lib/facets/core/string/test_bracket.rb +1 -1
  261. data/test/lib/facets/core/string/test_camelcase.rb +1 -1
  262. data/test/lib/facets/core/string/test_camelize.rb +1 -1
  263. data/test/lib/facets/core/string/test_capitalized.rb +1 -1
  264. data/test/lib/facets/core/string/test_chars.rb +1 -1
  265. data/test/lib/facets/core/string/test_cmp.rb +1 -1
  266. data/test/lib/facets/core/string/test_demodulize.rb +1 -1
  267. data/test/lib/facets/core/string/test_divide.rb +1 -1
  268. data/test/lib/facets/core/string/test_downcase.rb +1 -1
  269. data/test/lib/facets/core/string/test_dresner.rb +1 -1
  270. data/test/lib/facets/core/string/test_each_char.rb +1 -1
  271. data/test/lib/facets/core/string/test_each_word.rb +1 -1
  272. data/test/lib/facets/core/string/test_first.rb +1 -1
  273. data/test/lib/facets/core/string/test_fold.rb +1 -1
  274. data/test/lib/facets/core/string/test_humanize.rb +1 -1
  275. data/test/lib/facets/core/string/test_indent.rb +1 -1
  276. data/test/lib/facets/core/string/test_index_all.rb +1 -1
  277. data/test/lib/facets/core/string/test_last.rb +1 -1
  278. data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
  279. data/test/lib/facets/core/string/test_lines.rb +1 -1
  280. data/test/lib/facets/core/string/test_lowercase.rb +1 -1
  281. data/test/lib/facets/core/string/test_margin.rb +1 -1
  282. data/test/lib/facets/core/string/test_methodize.rb +1 -1
  283. data/test/lib/facets/core/string/test_modulize.rb +1 -1
  284. data/test/lib/facets/core/string/test_mscan.rb +1 -1
  285. data/test/lib/facets/core/string/test_natcmp.rb +1 -1
  286. data/test/lib/facets/core/string/test_nchar.rb +1 -1
  287. data/test/lib/facets/core/string/test_pathize.rb +1 -1
  288. data/test/lib/facets/core/string/test_pop.rb +1 -1
  289. data/test/lib/facets/core/string/test_pot.rb +1 -1
  290. data/test/lib/facets/core/string/test_push.rb +1 -1
  291. data/test/lib/facets/core/string/test_quote.rb +1 -1
  292. data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
  293. data/test/lib/facets/core/string/test_rand_index.rb +1 -1
  294. data/test/lib/facets/core/string/test_range.rb +1 -1
  295. data/test/lib/facets/core/string/test_range_all.rb +1 -1
  296. data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
  297. data/test/lib/facets/core/string/test_regesc.rb +1 -1
  298. data/test/lib/facets/core/string/test_shatter.rb +1 -1
  299. data/test/lib/facets/core/string/test_shift.rb +1 -1
  300. data/test/lib/facets/core/string/test_shuffle.rb +1 -1
  301. data/test/lib/facets/core/string/test_similarity.rb +1 -1
  302. data/test/lib/facets/core/string/test_singular.rb +1 -1
  303. data/test/lib/facets/core/string/test_soundex.rb +1 -1
  304. data/test/lib/facets/core/string/test_succ.rb +1 -1
  305. data/test/lib/facets/core/string/test_to_a.rb +1 -1
  306. data/test/lib/facets/core/string/test_to_b.rb +1 -1
  307. data/test/lib/facets/core/string/test_to_const.rb +1 -1
  308. data/test/lib/facets/core/string/test_to_date.rb +1 -1
  309. data/test/lib/facets/core/string/test_to_proc.rb +1 -1
  310. data/test/lib/facets/core/string/test_to_re.rb +1 -1
  311. data/test/lib/facets/core/string/test_to_time.rb +1 -1
  312. data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
  313. data/test/lib/facets/core/string/test_unpack.rb +1 -1
  314. data/test/lib/facets/core/string/test_unshift.rb +1 -1
  315. data/test/lib/facets/core/string/test_upcase.rb +1 -1
  316. data/test/lib/facets/core/string/test_whitespace.rb +1 -1
  317. data/test/lib/facets/core/string/test_word_filter.rb +1 -1
  318. data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
  319. data/test/lib/facets/core/string/test_words.rb +1 -1
  320. data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
  321. data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
  322. data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
  323. data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
  324. data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
  325. data/test/lib/facets/core/symbol/test_not.rb +1 -1
  326. data/test/lib/facets/core/symbol/test_pad.rb +1 -1
  327. data/test/lib/facets/core/symbol/test_succ.rb +1 -1
  328. data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
  329. data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
  330. data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
  331. data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
  332. data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
  333. data/test/lib/facets/core/time/test_change.rb +1 -1
  334. data/test/lib/facets/core/time/test_elapse.rb +1 -1
  335. data/test/lib/facets/core/time/test_stamp.rb +1 -1
  336. data/test/lib/facets/core/time/test_to_date.rb +1 -1
  337. data/test/lib/facets/core/time/test_to_s.rb +1 -1
  338. data/test/lib/facets/core/time/test_to_time.rb +1 -1
  339. data/test/lib/facets/more/test_annattr.rb +1 -1
  340. data/test/lib/facets/more/test_annotation.rb +11 -1
  341. data/test/lib/facets/more/test_ansicode.rb +1 -1
  342. data/test/lib/facets/more/test_association.rb +1 -1
  343. data/test/lib/facets/more/test_autoarray.rb +1 -1
  344. data/test/lib/facets/more/test_basicobject.rb +1 -1
  345. data/test/lib/facets/more/test_bbcode.rb +1 -1
  346. data/test/lib/facets/more/test_binaryreader.rb +1 -1
  347. data/test/lib/facets/more/test_bitmask.rb +1 -1
  348. data/test/lib/facets/more/test_bytes.rb +1 -1
  349. data/test/lib/facets/more/test_classmethods.rb +1 -1
  350. data/test/lib/facets/more/test_command.rb +1 -1
  351. data/test/lib/facets/more/test_coroutine.rb +1 -1
  352. data/test/lib/facets/more/test_crypt.rb +1 -1
  353. data/test/lib/facets/more/test_cut.rb +1 -1
  354. data/test/lib/facets/more/test_dictionary.rb +1 -1
  355. data/test/lib/facets/more/test_elementor.rb +1 -1
  356. data/test/lib/facets/more/test_enumerablepass.rb +1 -1
  357. data/test/lib/facets/more/test_floatstring.rb +1 -1
  358. data/test/lib/facets/more/test_functor.rb +1 -1
  359. data/test/lib/facets/more/test_htmlbuilder.rb +1 -1
  360. data/test/lib/facets/more/test_infinity.rb +1 -1
  361. data/test/lib/facets/more/test_inheritor.rb +1 -1
  362. data/test/lib/facets/more/test_instance_intercept.rb +1 -1
  363. data/test/lib/facets/more/test_interval.rb +1 -1
  364. data/test/lib/facets/more/test_json.rb +1 -1
  365. data/test/lib/facets/more/test_linkedlist.rb +53 -0
  366. data/test/lib/facets/more/test_lisp.rb +1 -1
  367. data/test/lib/facets/more/test_lisp_format.rb +1 -1
  368. data/test/lib/facets/more/test_lrucache.rb +1 -1
  369. data/test/lib/facets/more/test_mathconstants.rb +1 -1
  370. data/test/lib/facets/more/test_methodfilter.rb +1 -1
  371. data/test/lib/facets/more/test_methodprobe.rb +1 -1
  372. data/test/lib/facets/more/test_multipliers.rb +1 -1
  373. data/test/lib/facets/more/test_multiton.rb +1 -1
  374. data/test/lib/facets/more/test_nackclass.rb +1 -1
  375. data/test/lib/facets/more/test_nilcomparable.rb +1 -1
  376. data/test/lib/facets/more/test_opencascade.rb +1 -1
  377. data/test/lib/facets/more/test_openobject.rb +1 -1
  378. data/test/lib/facets/more/test_overload.rb +1 -1
  379. data/test/lib/facets/more/test_paramix.rb +1 -1
  380. data/test/lib/facets/more/test_pqueue.rb +1 -1
  381. data/test/lib/facets/more/test_predicate.rb +1 -1
  382. data/test/lib/facets/more/test_preinitialize.rb +1 -1
  383. data/test/lib/facets/more/test_promoteself.rb +1 -1
  384. data/test/lib/facets/more/test_recorder.rb +1 -1
  385. data/test/lib/facets/more/test_snapshot.rb +1 -1
  386. data/test/lib/facets/more/test_statichash.rb +1 -1
  387. data/test/lib/facets/more/test_syncarray.rb +1 -1
  388. data/test/lib/facets/more/test_synchash.rb +1 -1
  389. data/test/lib/facets/more/test_tagiterator.rb +1 -1
  390. data/test/lib/facets/more/test_taskable.rb +1 -1
  391. data/test/lib/facets/more/test_timer.rb +1 -1
  392. data/test/lib/facets/more/test_times.rb +1 -1
  393. data/test/lib/facets/more/test_tuple.rb +1 -1
  394. data/test/lib/facets/more/test_typecast.rb +1 -1
  395. data/test/lib/facets/more/test_uninheritable.rb +1 -1
  396. data/test/lib/facets/more/test_units.rb +1 -1
  397. data/test/lib/facets/more/test_xmlbuilder.rb +1 -1
  398. data/test/lib/facets/more/test_xmlhelper.rb +1 -1
  399. data/test/lib/facets/more/test_xoxo.rb +1 -1
  400. data/test/lib/facets/more/test_yamlstruct.rb +1 -1
  401. data/util/package +1 -1
  402. metadata +17 -5
  403. data/lib/facet/enumerable/permute.rb +0 -1
data/README CHANGED
@@ -6,12 +6,23 @@
6
6
 
7
7
  == Introduction
8
8
 
9
- Ruby Facets is the a collection of general purpose, pure-Ruby extensions and additions for the Ruby programming language. Facets is divided into two libraries, one for the extensions and the other for the additions. called Facets/CORE and Facets/MORE, respectively.
10
-
11
- Facets/CORE is a large collection of methods which extend the core capabilities of Ruby's built-in classes and modules. This collection of extension methods are unique by virtue of their atomicity. The methods are stored individually so that each can be required independently. This gives developers fine-grain control over which extra methods to bring into his or her code. The collection currently contains over 400 methods spanning 28 classes and modules. It is an _atomic_ library in that the methods are packaged individually so that each can be _required_ independently. This gives the programmer greater
12
- control to include only the extra methods he or she actually needs.
13
-
14
- Facets/MORE are a collection of classes, modules and light frameworks whcih consitutes an ever growing and improving source of reusable components. Some very nice additions are provided, from an amazing SI Units system to an elegant Annotations system. And of course there are all the more typical goodies like Tuple, Functor and Multiton.
9
+ Ruby Facets is a collection of general purpose, pure-Ruby extensions and additions
10
+ for the Ruby programming language. Facets is divided into two libraries, one for the
11
+ extensions and the other for the additions. called Facets/CORE and Facets/MORE, respectively.
12
+
13
+ Facets/CORE is a large collection of methods which extend the core capabilities of Ruby's
14
+ built-in classes and modules. This collection of extension methods are unique by virtue of
15
+ their atomicity. The methods are stored individually so that each can be required independently.
16
+ This gives developers fine-grain control over which extra methods to bring into his or her code.
17
+ The collection currently contains over 400 methods spanning 28 classes and modules. It is an
18
+ _atomic_ library in that the methods are packaged individually so that each can be _required_
19
+ independently. This gives the programmer greater control to include only the extra methods he
20
+ or she actually needs.
21
+
22
+ Facets/MORE are a collection of classes, modules and light frameworks whcih consitutes an ever
23
+ growing and improving source of reusable components. Some very nice additions are provided,
24
+ from an amazing SI Units system to an elegant Annotations system. And of course there are all
25
+ the more typical goodies like Tuple, Functor and Multiton.
15
26
 
16
27
 
17
28
  == License
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.38 (2006-08-31)
1
+ 1.7.46 (2006-09-08)
@@ -1,3 +1,11 @@
1
+ * [deprecate] enumerable/permute.rb (replaced by permutation) and minor test fix to linkedlist.rb
2
+ * [added] linkedlist.rb (thanks Kirk Haines!)
3
+ * [added] enumerable/sum (thanks to Gavin Kistner)
4
+ * [added] array/each_combo and combos (Eunumerable.combinations will be deprecated eventually)
5
+ * [rename] changed enumerable/permute to permutation
6
+ * [update] annotation.rb, fixed :self key
7
+ * [added] pathname/op_div
8
+ * [deprecated] hash/each.rb
1
9
  * [removed] hash/each.rb, this variation of Hash#each is too "dangerous" in practice
2
10
  * [update] module/self/op_add.rb: fixed inclusion order
3
11
  * annotation.rb, return annotations of self when key is :self [updated]
@@ -0,0 +1 @@
1
+ require 'facets/core/array/combos.rb'
@@ -0,0 +1 @@
1
+ require 'facets/core/array/each_combo.rb'
@@ -0,0 +1 @@
1
+ require 'facets/core/enumerable/permutation.rb'
@@ -0,0 +1 @@
1
+ require 'facets/core/enumerable/sum.rb'
@@ -0,0 +1 @@
1
+ require 'facets/more/linkedlist.rb'
@@ -0,0 +1 @@
1
+ require 'facets/core/pathname/op_div.rb'
@@ -0,0 +1,3 @@
1
+ # stub
2
+ require 'facets/core/array/each_combo.rb'
3
+
@@ -0,0 +1,48 @@
1
+
2
+ class Array
3
+
4
+ # The array is expected to be and array of arrays, which
5
+ # iterates through combinations of each in position.
6
+ #
7
+ # a = [ [0,1], [2,3] ]
8
+ # a.each_combo { |c| p c }
9
+ #
10
+ # produces
11
+ #
12
+ # [0, 2]
13
+ # [0, 3]
14
+ # [1, 2]
15
+ # [1, 3]
16
+ #
17
+
18
+ def each_combo
19
+ a = collect{ |x|
20
+ x.respond_to?(:to_a) ? x.to_a : 0..x
21
+ }
22
+
23
+ if a.size == 1
24
+ r = a.shift
25
+ r.each{ |n|
26
+ yield n
27
+ }
28
+ else
29
+ r = a.shift
30
+ r.each{ |n|
31
+ a.each_combo{ |s|
32
+ yield [n, *s]
33
+ }
34
+ }
35
+ end
36
+ end
37
+
38
+
39
+ # As with each_combo but returns combos collected in an array.
40
+
41
+ def combos
42
+ a = []
43
+ each_combo{ |c| a << c }
44
+ a
45
+ end
46
+
47
+ end
48
+
@@ -3,7 +3,11 @@ require 'facet/integer/factorial'
3
3
 
4
4
  module Enumerable
5
5
 
6
- def permute(number)
6
+ # Permutation proves the possible orders of an enumerable.
7
+ # Each is index by a oermutation numnber. The maximum number of
8
+ # arrangements is the factorial of the size of the array.
9
+
10
+ def permutation(number)
7
11
  arr = to_a
8
12
  out = arr[0..0]
9
13
  nextfactor = factor = 1
@@ -18,6 +22,9 @@ module Enumerable
18
22
  }
19
23
  out
20
24
  end
25
+ alias :permute :permutation
26
+
27
+ #
21
28
 
22
29
  def permutation_number(original_array=self.to_a.sort)
23
30
  arr = to_a
@@ -2,7 +2,9 @@
2
2
  module Enumerable
3
3
 
4
4
  # Produces an array of arrays of all possible combinations
5
- # of the given arrays in the position given. (Explain me better?)
5
+ # of the given arrays in the positions given. (Imagine
6
+ # it like a slot machine dial. This gives evey combination
7
+ # that could come up.)
6
8
  #
7
9
  # a = %w|a b|
8
10
  # b = %w|a x|
@@ -42,12 +44,19 @@ end
42
44
 
43
45
  class TCEnumerable < Test::Unit::TestCase
44
46
 
45
- def test_combinations
47
+ def test_01
46
48
  a = [1,2]
47
49
  b = [3,4]
48
- r = Enumerable.combinations(a,b)
49
- assert_equal( [[1,3],[1,4],[2,3],[2,4]], r )
50
+ z = Enumerable.combinations(a,b)
51
+ r = [[1,3],[1,4],[2,3],[2,4]]
52
+ assert_equal( r, z )
53
+ end
50
54
 
55
+ def test_02
56
+ a = %w|a b|
57
+ b = %w|a x|
58
+ c = %w|x y|
59
+ z = Enumerable.combinations(a, b, c)
51
60
  r = [ ["a", "a", "x"],
52
61
  ["a", "a", "y"],
53
62
  ["a", "x", "x"],
@@ -56,10 +65,6 @@ end
56
65
  ["b", "a", "y"],
57
66
  ["b", "x", "x"],
58
67
  ["b", "x", "y"] ]
59
- a = %w|a b|
60
- b = %w|a x|
61
- c = %w|x y|
62
- z = Enumerable.combinations(a, b, c)
63
68
  assert_equal( r, z )
64
69
  end
65
70
 
@@ -0,0 +1,19 @@
1
+ #--
2
+ # CREDIT Gavin Kistner
3
+ #++
4
+
5
+ module Enumerable
6
+
7
+ # Uses #+ to sum the enumerated elements.
8
+ #
9
+ # [1,2,3].sum #=> 6
10
+ # [3,3,3].sum #=> 9
11
+
12
+ def sum
13
+ v = 0
14
+ each{ |n| v+=n }
15
+ v
16
+ end
17
+
18
+ end
19
+
@@ -0,0 +1,4 @@
1
+
2
+ class Pathname
3
+ alias / +
4
+ end
@@ -469,6 +469,15 @@ end
469
469
  end
470
470
  end
471
471
 
472
+ class TestAnnotation10 < Test::Unit::TestCase
473
+ class C
474
+ ann :self, :mod => 'YES'
475
+ end
476
+ def test_10_01
477
+ assert_equal( 'YES', C.ann.self.mod )
478
+ end
479
+ end
480
+
472
481
  # class TestAnnotation10 < Test::Unit::TestCase
473
482
  # module M
474
483
  # ann :this, :koko => []
@@ -539,4 +548,5 @@ end
539
548
  # end
540
549
  # end
541
550
 
551
+
542
552
  =end
@@ -0,0 +1,254 @@
1
+ # = linkedlist.rb
2
+ #
3
+ # == Copyright (C) 2006 Kirk Haines
4
+ #
5
+ # General Public License (GPL)
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ #
26
+ # == Special Thanks
27
+ #
28
+ # LinkedList came from Kirk Hanes IOWA web framework.
29
+ #
30
+ # == Authors and Contributors
31
+ #
32
+ # * Kirk Haines <khaines@enigo.com>.
33
+ #
34
+ # == Developer Notes
35
+ #
36
+ # TODO Create an example of usage for docs.
37
+ #
38
+
39
+ # Author:: Jim Weirich
40
+ # Copyright:: Copyright (c) 2006 Kirk Haines
41
+ # License:: General Public License (GPL)
42
+
43
+ require 'enumerator'
44
+
45
+ # == LinkedList
46
+ #
47
+ # LinkedList implements a simple doubly linked list with efficient
48
+ # hash-like element access.
49
+ #
50
+ # This is a simple linked list implementation with efficient random
51
+ # access of data elements. It was inspired by George Moscovitis'
52
+ # LRUCache implementation found in Facets 1.7.30, but unlike the
53
+ # linked list in that cache, this one does not require the use of a
54
+ # mixin on any class to be stored. The linked list provides the
55
+ # push, pop, shift, unshift, first, last, delete and length methods
56
+ # which work just like their namesakes in the Array class, but it
57
+ # also supports setting and retrieving values by key, just like a
58
+ # hash.
59
+
60
+ class LinkedList
61
+
62
+ include Enumerable
63
+
64
+ # Represents a single node of the linked list.
65
+
66
+ class Node
67
+ attr_accessor :key, :value, :prev_node, :next_node
68
+
69
+ def initialize(key=nil,value=nil,prev_node=nil,next_node=nil)
70
+ @key = key
71
+ @value = value
72
+ @prev_node = prev_node
73
+ @next_node = next_node
74
+ end
75
+ end
76
+
77
+ def initialize
78
+ @head = Node.new
79
+ @tail = Node.new
80
+ @lookup = Hash.new
81
+ node_join(@head,@tail)
82
+ end
83
+
84
+ def [](v)
85
+ @lookup[v].value
86
+ end
87
+
88
+ def []=(k,v)
89
+ if @lookup.has_key?(k)
90
+ @lookup[k].value = v
91
+ else
92
+ n = Node.new(k,v,@head,@head.next_node)
93
+ node_join(n,@head.next_node)
94
+ node_join(@head,n)
95
+ @lookup[k] = n
96
+ end
97
+ v
98
+ end
99
+
100
+ def empty?
101
+ @lookup.empty?
102
+ end
103
+
104
+ def delete(k)
105
+ n = @lookup.delete(k)
106
+ v = n ? node_purge(n) : nil
107
+ v
108
+ end
109
+
110
+ def first
111
+ @head.next_node.value
112
+ end
113
+
114
+ def last
115
+ @tail.prev_node.value
116
+ end
117
+
118
+ def shift
119
+ k = @head.next_node.key
120
+ n = @lookup.delete(k)
121
+ node_delete(n) if n
122
+ end
123
+
124
+ def unshift(v)
125
+ if @lookup.has_key?(v)
126
+ n = @lookup[v]
127
+ node_delete(n)
128
+ node_join(n,@head.next_node)
129
+ node_join(@head,n)
130
+ else
131
+ n = Node.new(v,v,@head,@head.next_node)
132
+ node_join(n,@head.next_node)
133
+ node_join(@head,n)
134
+ @lookup[v] = n
135
+ end
136
+ v
137
+ end
138
+
139
+ def pop
140
+ k = @tail.prev_node.key
141
+ n = @lookup.delete(k)
142
+ node_delete(n) if n
143
+ end
144
+
145
+ def push(v)
146
+ if @lookup.has_key?(v)
147
+ n = @lookup[v]
148
+ node_delete(n)
149
+ node_join(@tail.prev_node,n)
150
+ node_join(n,@tail)
151
+ else
152
+ n = Node.new(v,v,@tail.prev_node,@tail)
153
+ node_join(@tail.prev_node,n)
154
+ node_join(n,@tail)
155
+ @lookup[v] = n
156
+ end
157
+ v
158
+ end
159
+
160
+ def queue
161
+ r = []
162
+ n = @head
163
+ while (n = n.next_node) and n != @tail
164
+ r << n.key
165
+ end
166
+ r
167
+ end
168
+
169
+ def to_a
170
+ r = []
171
+ n = @head
172
+ while (n = n.next_node) and n != @tail
173
+ r << n.value
174
+ end
175
+ r
176
+ end
177
+
178
+ def length
179
+ @lookup.length
180
+ end
181
+
182
+ def each
183
+ n = @head
184
+ while (n = n.next_node) and n != @tail
185
+ yield(n.key,n.value)
186
+ end
187
+ end
188
+
189
+ private
190
+
191
+ def node_delete(n)
192
+ node_join(n.prev_node,n.next_node)
193
+ v = n.value
194
+ end
195
+
196
+ def node_purge(n)
197
+ node_join(n.prev_node,n.next_node)
198
+ v = n.value
199
+ n.value = nil
200
+ n.key = nil
201
+ n.next_node = nil
202
+ n.prev_node = nil
203
+ v
204
+ end
205
+
206
+ def node_join(a,b)
207
+ a.next_node = b
208
+ b.prev_node = a
209
+ end
210
+
211
+ end
212
+
213
+
214
+
215
+ =begin test
216
+
217
+ require 'test/unit'
218
+
219
+ class TC_LinkedList < Test::Unit::TestCase
220
+
221
+ @cache
222
+
223
+ def test_all
224
+ ll = nil
225
+ assert_nothing_raised('Failed while creating an LinkedList object.') { ll = LinkedList.new }
226
+ assert_kind_of(LinkedList,ll,'Strangely, the created object does not appear to be an LinkedList.')
227
+
228
+ assert_nothing_raised('Failed while pushing a value onto the linked list.') { ll.push 'a' }
229
+ ll.push 'b'
230
+ assert_nothing_raised('Failed while assigning a key/value to the linked list.') { ll['c'] = 3 }
231
+ assert_equal(3,ll.first, 'First element in the linked list appears to be the wrong one.')
232
+ assert_equal('b',ll.last, 'Last element in the linked list appears to be the wrong one.')
233
+ assert_nothing_raised('Failed while unshifting a value onto the linked list.') { ll.unshift 'd' }
234
+ assert_equal('d',ll.first, 'The prior unshift apparently failed.')
235
+ assert_equal('a',ll['a'], 'Accessing an element by key failed.')
236
+ assert_equal(4,ll.length, 'The length of the linked list appears to be incorrect.')
237
+ d = nil
238
+ assert_nothing_raised('Failed while deleting an element from the middle of the list.') { d = ll.delete('a') }
239
+ assert_equal('a',d, 'The prior delete returned the wrong value for the deleted object.')
240
+ assert_equal(3,ll.length, 'The length of the linked list appears to be incorrect following the prior deletion.')
241
+ assert_nothing_raised('Failed while popping an element from the end of the list.') { d = ll.pop }
242
+ assert_equal('b',d, 'The prior pop returned the wrong value.')
243
+ assert_equal(2,ll.length, 'The length of the linked list appears to be incorrect following the prior pop.')
244
+ assert_equal(['d','c'],ll.queue, 'The queue of keys for the list is incorrect.')
245
+ assert_equal(['d',3],ll.to_a, 'Converting the list to an array (of values) seems to have failed.')
246
+ expected = [['c',3],['d','d']]
247
+ ll.each do |k,v|
248
+ e = expected.pop
249
+ assert_equal(e,[k,v], 'While iterates over the list via each(), the value from this iteration is not what was expected.')
250
+ end
251
+ end
252
+ end
253
+
254
+ =end