facets 1.3.1 → 1.3.2

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 (404) hide show
  1. data/CHANGELOG +7 -1
  2. data/ProjectInfo +4 -3
  3. data/data/facets/index.yml +1 -4
  4. data/lib/facet/gem/self/gemdir.rb +1 -0
  5. data/lib/facet/htmlbuilder.rb +1 -0
  6. data/lib/facet/htmlhelper.rb +1 -0
  7. data/lib/facet/xmlbuilder.rb +1 -0
  8. data/lib/facet/xmlhelper.rb +1 -0
  9. data/lib/facets/core/class/cattr.rb +25 -42
  10. data/lib/facets/core/gem.rb +1 -0
  11. data/lib/facets/core/gem/self/gemdir.rb +12 -0
  12. data/lib/facets/core/gem/self/gempath.rb +8 -2
  13. data/lib/facets/core/kernel/as.rb +3 -1
  14. data/lib/facets/core/module.rb +0 -4
  15. data/lib/facets/more/aspects.rb +29 -37
  16. data/lib/facets/more/basicobject.rb +69 -30
  17. data/lib/facets/more/builderobject.rb +41 -158
  18. data/lib/facets/more/downloader.rb +1 -1
  19. data/lib/facets/more/functor.rb +1 -0
  20. data/lib/facets/more/htmlbuilder.rb +83 -0
  21. data/lib/facets/more/htmlhelper.rb +9 -0
  22. data/lib/facets/more/multiton.rb +1 -4
  23. data/lib/facets/more/rexmlbuilder.rb +169 -13
  24. data/lib/facets/more/tuple.rb +3 -2
  25. data/lib/facets/more/xmlbuilder.rb +83 -0
  26. data/lib/facets/more/xmlhelper.rb +171 -0
  27. data/test/lib/facets/core/array/test_at_rand.rb +1 -1
  28. data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
  29. data/test/lib/facets/core/array/test_delete_values.rb +1 -1
  30. data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
  31. data/test/lib/facets/core/array/test_first.rb +1 -1
  32. data/test/lib/facets/core/array/test_head.rb +1 -1
  33. data/test/lib/facets/core/array/test_last_index.rb +1 -1
  34. data/test/lib/facets/core/array/test_merge.rb +1 -1
  35. data/test/lib/facets/core/array/test_mid.rb +1 -1
  36. data/test/lib/facets/core/array/test_middle.rb +1 -1
  37. data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
  38. data/test/lib/facets/core/array/test_op_store.rb +1 -1
  39. data/test/lib/facets/core/array/test_pick.rb +1 -1
  40. data/test/lib/facets/core/array/test_pos.rb +1 -1
  41. data/test/lib/facets/core/array/test_pot.rb +1 -1
  42. data/test/lib/facets/core/array/test_pull.rb +1 -1
  43. data/test/lib/facets/core/array/test_rand_index.rb +1 -1
  44. data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
  45. data/test/lib/facets/core/array/test_range.rb +1 -1
  46. data/test/lib/facets/core/array/test_rotate.rb +1 -1
  47. data/test/lib/facets/core/array/test_select.rb +1 -1
  48. data/test/lib/facets/core/array/test_shuffle.rb +1 -1
  49. data/test/lib/facets/core/array/test_thru.rb +1 -1
  50. data/test/lib/facets/core/array/test_to_b.rb +1 -1
  51. data/test/lib/facets/core/array/test_to_h.rb +1 -1
  52. data/test/lib/facets/core/array/test_to_hash.rb +1 -1
  53. data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
  54. data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
  55. data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
  56. data/test/lib/facets/core/binding/test_called.rb +1 -1
  57. data/test/lib/facets/core/binding/test_caller.rb +1 -1
  58. data/test/lib/facets/core/binding/test_defined.rb +1 -1
  59. data/test/lib/facets/core/binding/test_eval.rb +1 -1
  60. data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
  61. data/test/lib/facets/core/binding/test_method_name.rb +1 -1
  62. data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
  63. data/test/lib/facets/core/binding/test_op_store.rb +1 -1
  64. data/test/lib/facets/core/binding/test_self.rb +1 -1
  65. data/test/lib/facets/core/class/test_cattr.rb +1 -1
  66. data/test/lib/facets/core/class/test_descendents.rb +1 -1
  67. data/test/lib/facets/core/class/test_method_name.rb +1 -1
  68. data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
  69. data/test/lib/facets/core/class/test_unix_path.rb +1 -1
  70. data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
  71. data/test/lib/facets/core/comparable/test_clip.rb +1 -1
  72. data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
  73. data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
  74. data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
  75. data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
  76. data/test/lib/facets/core/date/test_stamp.rb +1 -1
  77. data/test/lib/facets/core/date/test_to_date.rb +1 -1
  78. data/test/lib/facets/core/date/test_to_s.rb +1 -1
  79. data/test/lib/facets/core/date/test_to_time.rb +1 -1
  80. data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
  81. data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
  82. data/test/lib/facets/core/enumerable/self/test_combinations.rb +1 -1
  83. data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
  84. data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
  85. data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
  86. data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
  87. data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
  88. data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
  89. data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
  90. data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
  91. data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
  92. data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
  93. data/test/lib/facets/core/enumerable/test_every.rb +1 -1
  94. data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
  95. data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
  96. data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
  97. data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
  98. data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
  99. data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
  100. data/test/lib/facets/core/enumerable/test_none.rb +1 -1
  101. data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
  102. data/test/lib/facets/core/enumerable/test_one.rb +1 -1
  103. data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
  104. data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
  105. data/test/lib/facets/core/enumerable/test_permute.rb +1 -1
  106. data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
  107. data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
  108. data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
  109. data/test/lib/facets/core/file/self/test_create.rb +1 -1
  110. data/test/lib/facets/core/file/self/test_open_as_string.rb +1 -1
  111. data/test/lib/facets/core/file/self/test_read_list.rb +1 -1
  112. data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
  113. data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
  114. data/test/lib/facets/core/float/test_round_at.rb +1 -1
  115. data/test/lib/facets/core/float/test_round_to.rb +1 -1
  116. data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
  117. data/test/lib/facets/core/hash/test_alias.rb +1 -1
  118. data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
  119. data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
  120. data/test/lib/facets/core/hash/test_at.rb +1 -1
  121. data/test/lib/facets/core/hash/test_collate.rb +1 -1
  122. data/test/lib/facets/core/hash/test_each.rb +1 -1
  123. data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
  124. data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
  125. data/test/lib/facets/core/hash/test_graph.rb +1 -1
  126. data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
  127. data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
  128. data/test/lib/facets/core/hash/test_inverse.rb +1 -1
  129. data/test/lib/facets/core/hash/test_keys_to_s.rb +1 -1
  130. data/test/lib/facets/core/hash/test_keys_to_sym.rb +1 -1
  131. data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
  132. data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
  133. data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
  134. data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
  135. data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
  136. data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
  137. data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
  138. data/test/lib/facets/core/hash/test_slice.rb +1 -1
  139. data/test/lib/facets/core/hash/test_swap.rb +1 -1
  140. data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
  141. data/test/lib/facets/core/hash/test_to_h.rb +1 -1
  142. data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
  143. data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
  144. data/test/lib/facets/core/hash/test_traverse.rb +1 -1
  145. data/test/lib/facets/core/hash/test_update_each.rb +1 -1
  146. data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
  147. data/test/lib/facets/core/hash/test_update_values.rb +1 -1
  148. data/test/lib/facets/core/hash/test_weave.rb +1 -1
  149. data/test/lib/facets/core/integer/test_factorial.rb +1 -1
  150. data/test/lib/facets/core/integer/test_multiple.rb +1 -1
  151. data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
  152. data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
  153. data/test/lib/facets/core/kernel/test___class__.rb +1 -1
  154. data/test/lib/facets/core/kernel/test_as.rb +1 -1
  155. data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
  156. data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
  157. data/test/lib/facets/core/kernel/test_bool.rb +1 -1
  158. data/test/lib/facets/core/kernel/test_bug.rb +1 -1
  159. data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
  160. data/test/lib/facets/core/kernel/test_called.rb +1 -1
  161. data/test/lib/facets/core/kernel/test_constant.rb +1 -1
  162. data/test/lib/facets/core/kernel/test_copy.rb +1 -1
  163. data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
  164. data/test/lib/facets/core/kernel/test_demo.rb +1 -1
  165. data/test/lib/facets/core/kernel/test_fn.rb +1 -1
  166. data/test/lib/facets/core/kernel/test_generate_method_name.rb +1 -1
  167. data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
  168. data/test/lib/facets/core/kernel/test_here.rb +1 -1
  169. data/test/lib/facets/core/kernel/test_in.rb +1 -1
  170. data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
  171. data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
  172. data/test/lib/facets/core/kernel/test_method.rb +1 -1
  173. data/test/lib/facets/core/kernel/test_methodname.rb +1 -1
  174. data/test/lib/facets/core/kernel/test_methods.rb +1 -1
  175. data/test/lib/facets/core/kernel/test_new.rb +1 -1
  176. data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
  177. data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
  178. data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
  179. data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
  180. data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
  181. data/test/lib/facets/core/kernel/test_resc.rb +1 -1
  182. data/test/lib/facets/core/kernel/test_returning.rb +1 -1
  183. data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
  184. data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
  185. data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
  186. data/test/lib/facets/core/kernel/test_silently.rb +1 -1
  187. data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
  188. data/test/lib/facets/core/kernel/test_superior.rb +1 -1
  189. data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
  190. data/test/lib/facets/core/kernel/test_this.rb +1 -1
  191. data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
  192. data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
  193. data/test/lib/facets/core/kernel/test_uri.rb +1 -1
  194. data/test/lib/facets/core/kernel/test_val.rb +1 -1
  195. data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
  196. data/test/lib/facets/core/matchdata/test_match.rb +1 -1
  197. data/test/lib/facets/core/matchdata/test_matchtree.rb +1 -1
  198. data/test/lib/facets/core/module/test_abstract.rb +1 -1
  199. data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
  200. data/test/lib/facets/core/module/test_ancestor.rb +1 -1
  201. data/test/lib/facets/core/module/test_basename.rb +1 -1
  202. data/test/lib/facets/core/module/test_by_name.rb +1 -1
  203. data/test/lib/facets/core/module/test_clone_using.rb +1 -1
  204. data/test/lib/facets/core/module/test_dirname.rb +1 -1
  205. data/test/lib/facets/core/module/test_equate_on.rb +1 -1
  206. data/test/lib/facets/core/module/test_generate_instance_method_name.rb +1 -1
  207. data/test/lib/facets/core/module/test_include_as.rb +1 -1
  208. data/test/lib/facets/core/module/test_inherit.rb +1 -1
  209. data/test/lib/facets/core/module/test_initializer.rb +1 -1
  210. data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
  211. data/test/lib/facets/core/module/test_integrate.rb +1 -1
  212. data/test/lib/facets/core/module/test_memoize.rb +1 -1
  213. data/test/lib/facets/core/module/test_modspace.rb +1 -1
  214. data/test/lib/facets/core/module/test_namespace.rb +1 -1
  215. data/test/lib/facets/core/module/test_nesting.rb +1 -1
  216. data/test/lib/facets/core/module/test_on_included.rb +1 -1
  217. data/test/lib/facets/core/module/test_redef.rb +1 -1
  218. data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
  219. data/test/lib/facets/core/module/test_redirect.rb +1 -1
  220. data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
  221. data/test/lib/facets/core/module/test_remove.rb +1 -1
  222. data/test/lib/facets/core/module/test_rename.rb +1 -1
  223. data/test/lib/facets/core/module/test_rename_method.rb +1 -1
  224. data/test/lib/facets/core/module/test_revisal.rb +1 -1
  225. data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
  226. data/test/lib/facets/core/module/test_sort_on.rb +1 -1
  227. data/test/lib/facets/core/module/test_this.rb +1 -1
  228. data/test/lib/facets/core/module/test_undef.rb +1 -1
  229. data/test/lib/facets/core/module/test_wrap.rb +1 -1
  230. data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
  231. data/test/lib/facets/core/nilclass/test_blank.rb +1 -1
  232. data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
  233. data/test/lib/facets/core/nilclass/test_include.rb +1 -1
  234. data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
  235. data/test/lib/facets/core/nilclass/test_size.rb +1 -1
  236. data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
  237. data/test/lib/facets/core/numeric/test_approx.rb +1 -1
  238. data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
  239. data/test/lib/facets/core/numeric/test_succ.rb +1 -1
  240. data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
  241. data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
  242. data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
  243. data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
  244. data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
  245. data/test/lib/facets/core/proc/test_compose.rb +1 -1
  246. data/test/lib/facets/core/proc/test_to_method.rb +1 -1
  247. data/test/lib/facets/core/range/test_to_r.rb +1 -1
  248. data/test/lib/facets/core/range/test_to_range.rb +1 -1
  249. data/test/lib/facets/core/range/test_umbrella.rb +1 -1
  250. data/test/lib/facets/core/range/test_within.rb +1 -1
  251. data/test/lib/facets/core/regexp/test_arity.rb +1 -1
  252. data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
  253. data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
  254. data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
  255. data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
  256. data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
  257. data/test/lib/facets/core/string/test_align_center.rb +1 -1
  258. data/test/lib/facets/core/string/test_at_rand.rb +1 -1
  259. data/test/lib/facets/core/string/test_basename.rb +1 -1
  260. data/test/lib/facets/core/string/test_blank.rb +1 -1
  261. data/test/lib/facets/core/string/test_bracket.rb +1 -1
  262. data/test/lib/facets/core/string/test_camelcase.rb +1 -1
  263. data/test/lib/facets/core/string/test_camelize.rb +1 -1
  264. data/test/lib/facets/core/string/test_capitalized.rb +1 -1
  265. data/test/lib/facets/core/string/test_chars.rb +1 -1
  266. data/test/lib/facets/core/string/test_cmp.rb +1 -1
  267. data/test/lib/facets/core/string/test_demodulize.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_frequency.rb +1 -1
  275. data/test/lib/facets/core/string/test_humanize.rb +1 -1
  276. data/test/lib/facets/core/string/test_indent.rb +1 -1
  277. data/test/lib/facets/core/string/test_index_all.rb +1 -1
  278. data/test/lib/facets/core/string/test_last.rb +1 -1
  279. data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
  280. data/test/lib/facets/core/string/test_lines.rb +1 -1
  281. data/test/lib/facets/core/string/test_lowercase.rb +1 -1
  282. data/test/lib/facets/core/string/test_margin.rb +1 -1
  283. data/test/lib/facets/core/string/test_methodize.rb +1 -1
  284. data/test/lib/facets/core/string/test_modulize.rb +1 -1
  285. data/test/lib/facets/core/string/test_mscan.rb +1 -1
  286. data/test/lib/facets/core/string/test_natcmp.rb +1 -1
  287. data/test/lib/facets/core/string/test_nchar.rb +1 -1
  288. data/test/lib/facets/core/string/test_pathize.rb +1 -1
  289. data/test/lib/facets/core/string/test_pop.rb +1 -1
  290. data/test/lib/facets/core/string/test_pot.rb +1 -1
  291. data/test/lib/facets/core/string/test_probability.rb +1 -1
  292. data/test/lib/facets/core/string/test_push.rb +1 -1
  293. data/test/lib/facets/core/string/test_quote.rb +1 -1
  294. data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
  295. data/test/lib/facets/core/string/test_rand_index.rb +1 -1
  296. data/test/lib/facets/core/string/test_range.rb +1 -1
  297. data/test/lib/facets/core/string/test_range_all.rb +1 -1
  298. data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
  299. data/test/lib/facets/core/string/test_regesc.rb +1 -1
  300. data/test/lib/facets/core/string/test_shatter.rb +1 -1
  301. data/test/lib/facets/core/string/test_shift.rb +1 -1
  302. data/test/lib/facets/core/string/test_shuffle.rb +1 -1
  303. data/test/lib/facets/core/string/test_similarity.rb +1 -1
  304. data/test/lib/facets/core/string/test_singular.rb +1 -1
  305. data/test/lib/facets/core/string/test_soundex.rb +1 -1
  306. data/test/lib/facets/core/string/test_succ.rb +1 -1
  307. data/test/lib/facets/core/string/test_to_a.rb +1 -1
  308. data/test/lib/facets/core/string/test_to_b.rb +1 -1
  309. data/test/lib/facets/core/string/test_to_const.rb +1 -1
  310. data/test/lib/facets/core/string/test_to_date.rb +1 -1
  311. data/test/lib/facets/core/string/test_to_proc.rb +1 -1
  312. data/test/lib/facets/core/string/test_to_re.rb +1 -1
  313. data/test/lib/facets/core/string/test_to_time.rb +1 -1
  314. data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
  315. data/test/lib/facets/core/string/test_unpack.rb +1 -1
  316. data/test/lib/facets/core/string/test_unshift.rb +1 -1
  317. data/test/lib/facets/core/string/test_upcase.rb +1 -1
  318. data/test/lib/facets/core/string/test_whitespace.rb +1 -1
  319. data/test/lib/facets/core/string/test_word_filter.rb +1 -1
  320. data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
  321. data/test/lib/facets/core/string/test_words.rb +1 -1
  322. data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
  323. data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
  324. data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
  325. data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
  326. data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
  327. data/test/lib/facets/core/symbol/test_not.rb +1 -1
  328. data/test/lib/facets/core/symbol/test_pad.rb +1 -1
  329. data/test/lib/facets/core/symbol/test_succ.rb +1 -1
  330. data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
  331. data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
  332. data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
  333. data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
  334. data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
  335. data/test/lib/facets/core/time/test_change.rb +1 -1
  336. data/test/lib/facets/core/time/test_elapse.rb +1 -1
  337. data/test/lib/facets/core/time/test_stamp.rb +1 -1
  338. data/test/lib/facets/core/time/test_to_date.rb +1 -1
  339. data/test/lib/facets/core/time/test_to_s.rb +1 -1
  340. data/test/lib/facets/core/time/test_to_time.rb +1 -1
  341. data/test/lib/facets/more/test_annotation.rb +1 -1
  342. data/test/lib/facets/more/test_ansicode.rb +1 -1
  343. data/test/lib/facets/more/test_association.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_bitmask.rb +1 -1
  347. data/test/lib/facets/more/test_bytes.rb +1 -1
  348. data/test/lib/facets/more/test_classinherit.rb +1 -1
  349. data/test/lib/facets/more/test_classmethods.rb +1 -1
  350. data/test/lib/facets/more/test_coroutine.rb +1 -1
  351. data/test/lib/facets/more/test_crypt.rb +1 -1
  352. data/test/lib/facets/more/test_dictionary.rb +1 -1
  353. data/test/lib/facets/more/test_elementor.rb +1 -1
  354. data/test/lib/facets/more/test_enumerablepass.rb +1 -1
  355. data/test/lib/facets/more/test_floatstring.rb +1 -1
  356. data/test/lib/facets/more/test_functor.rb +1 -1
  357. data/test/lib/facets/more/test_htmlbuilder.rb +38 -0
  358. data/test/lib/facets/more/test_inheritor.rb +1 -1
  359. data/test/lib/facets/more/test_interval.rb +1 -1
  360. data/test/lib/facets/more/test_json.rb +1 -1
  361. data/test/lib/facets/more/test_lisp.rb +1 -1
  362. data/test/lib/facets/more/test_lisp_format.rb +1 -1
  363. data/test/lib/facets/more/test_lrucache.rb +1 -1
  364. data/test/lib/facets/more/test_mathconstants.rb +1 -1
  365. data/test/lib/facets/more/test_methodprobe.rb +1 -1
  366. data/test/lib/facets/more/test_multipliers.rb +1 -1
  367. data/test/lib/facets/more/test_multiton.rb +1 -2
  368. data/test/lib/facets/more/test_nackclass.rb +1 -1
  369. data/test/lib/facets/more/test_nilcomparable.rb +1 -1
  370. data/test/lib/facets/more/test_openobject.rb +1 -1
  371. data/test/lib/facets/more/test_overload.rb +1 -1
  372. data/test/lib/facets/more/test_paramix.rb +1 -1
  373. data/test/lib/facets/more/test_preinitialize.rb +1 -1
  374. data/test/lib/facets/more/test_promoteself.rb +1 -1
  375. data/test/lib/facets/more/test_recorder.rb +1 -1
  376. data/test/lib/facets/more/test_snapshot.rb +1 -1
  377. data/test/lib/facets/more/test_statichash.rb +1 -1
  378. data/test/lib/facets/more/test_syncarray.rb +1 -1
  379. data/test/lib/facets/more/test_synchash.rb +1 -1
  380. data/test/lib/facets/more/test_tagiterator.rb +1 -1
  381. data/test/lib/facets/more/test_timer.rb +1 -1
  382. data/test/lib/facets/more/test_times.rb +1 -1
  383. data/test/lib/facets/more/test_tuple.rb +1 -1
  384. data/test/lib/facets/more/test_typecast.rb +1 -1
  385. data/test/lib/facets/more/test_uninheritable.rb +1 -1
  386. data/test/lib/facets/more/test_units.rb +1 -1
  387. data/test/lib/facets/more/test_xmlbuilder.rb +38 -0
  388. data/test/lib/facets/more/test_xmlhelper.rb +40 -0
  389. data/test/lib/facets/more/test_xoxo.rb +1 -1
  390. data/test/lib/facets/more/test_yamlstruct.rb +1 -1
  391. metadata +17 -17
  392. data/lib/facet/module/mattr.rb +0 -1
  393. data/lib/facet/module/mattr_accessor.rb +0 -1
  394. data/lib/facet/module/mattr_reader.rb +0 -1
  395. data/lib/facet/module/mattr_writer.rb +0 -1
  396. data/lib/facets/core/module/mattr.rb +0 -180
  397. data/lib/facets/core/module/mattr_accessor.rb +0 -2
  398. data/lib/facets/core/module/mattr_reader.rb +0 -2
  399. data/lib/facets/core/module/mattr_writer.rb +0 -2
  400. data/test/lib/facets/core/array/test_slap.rb +0 -28
  401. data/test/lib/facets/core/module/test_let.rb +0 -31
  402. data/test/lib/facets/core/module/test_mattr.rb +0 -71
  403. data/test/lib/facets/core/string/test_slap.rb +0 -40
  404. data/test/lib/facets/core/string/test_to_arr.rb +0 -26
@@ -1,20 +1,31 @@
1
1
  #--
2
- # BuilderFactory
2
+ # BuilderObject
3
3
  # Copyright (c) 2006 Thomas Sawyer
4
4
  #
5
5
  # Ruby License
6
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
+ # ==========================================================================
15
+ # Revision Notes
16
+ # --------------------------------------------------------------------------
17
+ # 2006-04-18 trans Created.
18
+ # ==========================================================================
7
19
  #++
8
20
 
9
- require 'rexml/document'
10
21
 
11
- require 'facets/core/hash/keys_to_s'
12
- require 'facets/core/kernel/own'
13
- require 'facets/more/functor' # already requires basicobject
22
+ #require 'facets/more/basicobject'
23
+ require 'facets/more/functor'
24
+
14
25
 
15
26
  # :title: BuilderObject
16
27
  #
17
- # Build structures programatically with Ruby and Ruby's blocks.
28
+ # Build content programatically with Ruby and Ruby's blocks.
18
29
  #
19
30
  # Builders can use either an implict or explicit receiver.
20
31
  # Explicit is the default. To use implicit pass the :implicit
@@ -31,186 +42,58 @@ require 'facets/more/functor' # already requires basicobject
31
42
  # routes all builder method vis the #out method.
32
43
  #
33
44
  # NOTE The name of this method (#out) may be changed.
45
+ #
46
+ # AUTHORS:: Thomas Sawyer
47
+ #
34
48
 
35
49
  class BuilderObject < BasicObject
36
50
 
37
- # Builder mixin.
38
-
39
51
  def self.builder
40
- @builder ||= Module.new
52
+ @builder ||= Class.new
41
53
  end
42
54
 
43
- def self.builder_include( *mod )
44
- builder.module_eval { extend *mod }
55
+ def self.builder_include( mod )
56
+ builder.class_eval { include mod }
45
57
  end
46
58
 
47
- private
48
-
49
- def builder
50
- self.__class__.builder
51
- end
52
-
53
- # Prepare builder.
54
-
55
- def initialize( *options )
56
- # initialize options
57
- @options = (Hash === options.last ? options.pop : {} )
58
- options.each { |o| @options[o] = true }
59
- # initialize stack
59
+ def initialize
60
60
  @stack = []
61
- # initialize buffer
62
- @target = builder.new( @options )
63
- end
64
-
65
- # Core of Builder's functionality.
66
-
67
- def method_missing( tag, *args, &block )
68
- if @current and block_given?
69
- @stack << @target
70
- @target = @current
71
- if @options[:implicit]
72
- instance_eval( &block )
73
- else
74
- block.call
75
- end
76
- @target = @stack.pop
77
- end
78
- @target
79
- end
80
-
81
- # Creates object via builder modules,
82
- # stores as current and appends to buffer.
83
-
84
- def +( op, *args, &blk )
85
- obj = builder.send( op, *args, &blk )
86
- @current = obj
87
- @target << obj
88
- self
61
+ @buffer = ''
89
62
  end
90
63
 
91
- public
92
-
93
- # raw insert
94
-
95
- def <<( str )
96
- r = builder.raw( str )
97
- if Array === r
98
- r.each { |e| @target << e }
99
- else
100
- @target << r
101
- end
102
- self
64
+ def builder
65
+ @builder ||= self.__class__.builder.new
103
66
  end
104
67
 
105
- # Redirection functor.
106
- #--
107
- # TODO Better name?
108
- #++
109
-
110
68
  def out( str=nil )
111
69
  if str
112
- self << str
70
+ @buffer << str
113
71
  else
114
72
  @builder_functor ||= Functor.new( &__method__(:+) )
115
73
  end
116
74
  end
117
75
 
118
- # text output
76
+ def +( op, *args, &blk )
77
+ @buffer << builder.send( op, *args, &blk )
78
+ end
119
79
 
120
80
  def to_s
121
- @target.to_s
81
+ @buffer
122
82
  end
123
83
 
124
84
  end
125
85
 
126
86
 
127
- # Some prebuilt mixin modules for creating builders.
128
- # These could also be used without builder.
129
-
130
- module BuilderObject::REXML
131
87
 
132
- extend self
133
-
134
- # Add raw XML markup
135
-
136
- def raw( str )
137
- REXML::Document.new( "<root>#{str}</root>" ).root.to_a
138
- end
139
-
140
- # New REXML document.
141
-
142
- def document( options={} )
143
- @options = options
144
- doc = REXML::Document.new
145
- # xml declaration
146
- if options[:version]
147
- doc << xml(
148
- options[:version],
149
- options[:encoding],
150
- options[:standalone]
151
- )
152
- end
153
- doc
154
- end
155
-
156
- # Used for initial buffer value in a builder.
157
-
158
- alias_method :new, :document
159
-
160
- # XML declaration
161
-
162
- def xml( version=nil, *args )
163
- REXML::XMLDecl.new( version=nil, *args )
164
- end
165
-
166
- def element( tag, *args )
167
- keys = (Hash === args.last ? args.pop : {})
168
- e = REXML::Element.new( tag )
169
- e.add_attributes( keys.keys_to_s )
170
- e.add_text(args.join(' ')) unless args.empty?
171
- e
172
- end
173
-
174
- def instruct( name, *args )
175
- keys = (Hash === args.last ? args.pop : {})
176
- content = ( args + keys.collect{ |k,v| %{#{k}="#{v}"} } ).join(' ')
177
- REXML::Instruction.new( name, content.strip )
178
- end
179
- alias_method :instruction, :instruct
180
- alias_method :pi, :instruct
181
-
182
- def text( str, *args )
183
- REXML::Text.new( str, *args )
184
- end
185
-
186
- def comment( str, *args )
187
- REXML::Comment.new( str, *args )
188
- end
189
-
190
- def cdata( str, *args )
191
- REXML::CData.new( str, *args )
192
- end
193
-
194
- # DTD declarations
195
-
196
- def doctype!( *args )
197
- REXML::DocType.new( *args )
198
- end
199
-
200
- def element!( *args )
201
- REXML::ElementDecl.new( *args )
202
- end
88
+ # _____ _
89
+ # |_ _|__ ___| |_
90
+ # | |/ _ \/ __| __|
91
+ # | | __/\__ \ |_
92
+ # |_|\___||___/\__|
93
+ #
203
94
 
204
- def attlist!( *args )
205
- REXML::AttlistDecl.new( *args )
206
- end
95
+ # TODO
207
96
 
208
- def entity!( *args )
209
- REXML::EntityDecl.new( *args )
210
- end
97
+ =begin
98
+ =end
211
99
 
212
- def notation!( *args )
213
- REXML::NotationDecl.new( *args )
214
- end
215
-
216
- end
@@ -25,7 +25,7 @@ require 'digest/md5'
25
25
  require 'open-uri'
26
26
 
27
27
  require 'facet/string/unbracket'
28
- require 'calib/progressbar'
28
+ require 'facets/more/progressbar'
29
29
 
30
30
  # :title: Downloader
31
31
  #
@@ -71,6 +71,7 @@ class Functor < BasicObject
71
71
  end
72
72
 
73
73
 
74
+
74
75
  # _____ _
75
76
  # |_ _|__ ___| |_
76
77
  # | |/ _ \/ __| __|
@@ -0,0 +1,83 @@
1
+ #--
2
+ # HTMLBuilder
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
+ # ==========================================================================
15
+ # Revision History
16
+ # --------------------------------------------------------------------------
17
+ # 2006-04-18 trans Created.
18
+ # ==========================================================================
19
+ #++
20
+
21
+ require 'facets/more/builderobject.rb'
22
+ require 'facets/more/htmlhelper.rb'
23
+
24
+ #:title: HTMLBuilder
25
+ #
26
+ # HTMLBuilder follows the _Builder Pattern_ allowing XML markup to be
27
+ # constructed via Ruby method calls and block structures.
28
+ #
29
+ # Author:: Thomas Sawyer
30
+ # Copright:: Copyright (c) 2006 Thomas Sawyer
31
+ # License:: Ruby License
32
+
33
+ class HTMLBuilder < BuilderObject
34
+
35
+ builder_include HTMLHelper
36
+
37
+ def method_missing( op, *args, &block )
38
+ if block_given?
39
+ @stack << @buffer
40
+ @buffer = ''
41
+ body = block.call
42
+ @buffer = @stack.pop
43
+ @buffer << builder.element( op, body, *args )
44
+ else
45
+ @buffer << builder.element( op, *args )
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+
52
+
53
+ # _____ _
54
+ # |_ _|__ ___| |_
55
+ # | |/ _ \/ __| __|
56
+ # | | __/\__ \ |_
57
+ # |_|\___||___/\__|
58
+ #
59
+ =begin test rdoc
60
+
61
+ require 'test/unit'
62
+
63
+ class TCHTMLBuilder < Test::Unit::TestCase
64
+
65
+ def test_01
66
+ x = HTMLBuilder.new
67
+ doc = x.html {
68
+ x.head {
69
+ x.title "Test"
70
+ }
71
+ x.body {
72
+ x.p "Hello"
73
+ x.out.text "Test"
74
+ }
75
+ }
76
+ r = "<html><head><title>Test</title></head><body><p>Hello</p>Test</body></html>"
77
+ assert_equal( r, doc )
78
+ assert_equal( r, x.to_s )
79
+ end
80
+
81
+ end
82
+
83
+ =end
@@ -0,0 +1,9 @@
1
+ require 'facets/more/xmlhelper.rb'
2
+
3
+ module HTMLHelper
4
+ include XMLHelper
5
+
6
+ end
7
+
8
+ # :vim: indent=2
9
+
@@ -1,6 +1,5 @@
1
1
  #--
2
2
  # Multiton
3
- #
4
3
  # Copyright (c) 2005 Florian Frank, Thomas Sawyer
5
4
  #
6
5
  # Ruby License
@@ -12,9 +11,8 @@
12
11
  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
12
  # FOR A PARTICULAR PURPOSE.
14
13
  #
15
- #
16
14
  # ==========================================================================
17
- # Revision History ::
15
+ # Revision Notes
18
16
  # --------------------------------------------------------------------------
19
17
  # 2005-11-27 trans * Simplifed variations to one.
20
18
  # 2005-08-01 trans * Minor modifications to documentation.
@@ -208,7 +206,6 @@ end
208
206
 
209
207
  end
210
208
 
211
-
212
209
  #
213
210
  # EXAMPLE B - MODIFY AN EXISTING CLASS, SHARED FILEHANDLES
214
211
  #
@@ -1,13 +1,10 @@
1
1
  #--
2
- # XmlBuilder
3
- # Copyright (c) 2006 Thomas Sawyer
4
- #
5
- # Ruby License
6
- #
2
+ # REXMLBuilder
7
3
  #++
8
4
 
9
5
  require 'rexml/document'
10
- require 'facets/more/builderobject'
6
+
7
+ require 'facets/more/functor' # already requires basicobject
11
8
 
12
9
  # :title: REXMLBuilder
13
10
  #
@@ -49,9 +46,7 @@ require 'facets/more/builderobject'
49
46
  # the array.
50
47
  #
51
48
 
52
- class REXMLBuilder < BuilderObject
53
-
54
- builder_include BuilderObject::REXML
49
+ class REXMLBuilder < BasicObject
55
50
 
56
51
  # Output XML document.
57
52
 
@@ -61,7 +56,56 @@ class REXMLBuilder < BuilderObject
61
56
  o
62
57
  end
63
58
 
64
- # Reroute to output.
59
+ # raw insert
60
+
61
+ def <<( str )
62
+ r = builder.raw( str )
63
+ if Array === r
64
+ r.each { |e| @target << e }
65
+ else
66
+ @target << r
67
+ end
68
+ self
69
+ end
70
+
71
+ # Redirection functor.
72
+ #--
73
+ # TODO Better name?
74
+ #++
75
+
76
+ def out( str=nil )
77
+ if str
78
+ self << str
79
+ else
80
+ @builder_functor ||= Functor.new( &__method__(:+) )
81
+ end
82
+ end
83
+
84
+ # text output
85
+
86
+ def to_s
87
+ @target.to_s
88
+ end
89
+
90
+ private
91
+
92
+ def builder
93
+ REXMLUtil
94
+ end
95
+
96
+ # Prepare builder.
97
+
98
+ def initialize( *options )
99
+ # initialize options
100
+ @options = (Hash === options.last ? options.pop : {} )
101
+ options.each { |o| @options[o] = true }
102
+ # initialize stack
103
+ @stack = []
104
+ # initialize buffer
105
+ @target = builder.new( @options )
106
+ end
107
+
108
+ # Reroute -- Core functionality.
65
109
 
66
110
  def method_missing( tag, *args, &block )
67
111
  tag = tag.to_s
@@ -73,7 +117,119 @@ class REXMLBuilder < BuilderObject
73
117
  else
74
118
  out.element( tag, *args )
75
119
  end
76
- super
120
+ if @current and block_given?
121
+ @stack << @target
122
+ @target = @current
123
+ if @options[:implicit]
124
+ instance_eval( &block )
125
+ else
126
+ block.call
127
+ end
128
+ @target = @stack.pop
129
+ end
130
+ @target
131
+ end
132
+
133
+ # Creates object via builder module,
134
+ # stores as current and appends to buffer.
135
+
136
+ def +( op, *args, &blk )
137
+ obj = builder.send( op, *args, &blk )
138
+ @current = obj
139
+ @target << obj
140
+ self
141
+ end
142
+
143
+ end
144
+
145
+ # Module provides the build methods in
146
+ # an independent namespace.
147
+
148
+ module REXMLBuilder::REXMLUtil
149
+
150
+ extend self
151
+
152
+ # Add raw XML markup
153
+
154
+ def raw( str )
155
+ REXML::Document.new( "<root>#{str}</root>" ).root.to_a
156
+ end
157
+
158
+ # New REXML document.
159
+
160
+ def document( options={} )
161
+ #@options = options
162
+ doc = REXML::Document.new
163
+ # xml declaration
164
+ if options[:version]
165
+ doc << xml(
166
+ options[:version],
167
+ options[:encoding],
168
+ options[:standalone]
169
+ )
170
+ end
171
+ doc
172
+ end
173
+
174
+ # Used for initial taget in builder.
175
+ alias_method :new, :document
176
+
177
+ # XML declaration instruction.
178
+
179
+ def xml( version=nil, *args )
180
+ REXML::XMLDecl.new( version=nil, *args )
181
+ end
182
+
183
+ def element( tag, *args )
184
+ keys = (Hash === args.last ? args.pop : {})
185
+ skeys = {}
186
+ keys.each { |k,v| skeys[k.to_s] = v.to_s }
187
+ e = REXML::Element.new( tag )
188
+ e.add_attributes( skeys )
189
+ e.add_text(args.join(' ')) unless args.empty?
190
+ e
191
+ end
192
+
193
+ def instruct( name, *args )
194
+ keys = (Hash === args.last ? args.pop : {})
195
+ content = ( args + keys.collect{ |k,v| %{#{k}="#{v}"} } ).join(' ')
196
+ REXML::Instruction.new( name, content.strip )
197
+ end
198
+ alias_method :instruction, :instruct
199
+ alias_method :pi, :instruct
200
+
201
+ def text( str, *args )
202
+ REXML::Text.new( str, *args )
203
+ end
204
+
205
+ def comment( str, *args )
206
+ REXML::Comment.new( str, *args )
207
+ end
208
+
209
+ def cdata( str, *args )
210
+ REXML::CData.new( str, *args )
211
+ end
212
+
213
+ # DTD declarations
214
+
215
+ def doctype!( *args )
216
+ REXML::DocType.new( *args )
217
+ end
218
+
219
+ def element!( *args )
220
+ REXML::ElementDecl.new( *args )
221
+ end
222
+
223
+ def attlist!( *args )
224
+ REXML::AttlistDecl.new( *args )
225
+ end
226
+
227
+ def entity!( *args )
228
+ REXML::EntityDecl.new( *args )
229
+ end
230
+
231
+ def notation!( *args )
232
+ REXML::NotationDecl.new( *args )
77
233
  end
78
234
 
79
235
  end
@@ -82,7 +238,7 @@ end
82
238
 
83
239
  # TODO
84
240
 
85
- #=begin
241
+ =begin
86
242
 
87
243
  x = REXMLBuilder.new( :version => '1.0' )
88
244
 
@@ -101,4 +257,4 @@ x.html {
101
257
 
102
258
  puts x
103
259
 
104
- #=end
260
+ =end