facets 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (321) hide show
  1. data/HISTORY.rdoc +331 -35
  2. data/MANIFEST +685 -826
  3. data/{doc/guide/notes.rd → NOTES} +0 -0
  4. data/README.rdoc +73 -25
  5. data/Rakefile +245 -2
  6. data/TODO +5 -0
  7. data/demo/hook.rd +47 -0
  8. data/demo/scenario_require.rd +9 -0
  9. data/doc/README.more +24 -6
  10. data/doc/manual/about.rb +47 -0
  11. data/doc/manual/annotations.rdoc +60 -0
  12. data/doc/manual/associations.rdoc +55 -0
  13. data/doc/manual/blockups.rdoc +101 -0
  14. data/doc/manual/capsule.rdoc +34 -0
  15. data/doc/manual/command.rdoc +177 -0
  16. data/doc/manual/core.rdoc +37 -0
  17. data/doc/manual/faq.rdoc +32 -0
  18. data/doc/manual/typecast.html +112 -0
  19. data/lib/core/facets.rb +359 -11
  20. data/lib/core/facets/array/combination.rb +3 -3
  21. data/lib/core/facets/array/index.rb +4 -1
  22. data/lib/core/facets/array/permutation.rb +2 -2
  23. data/lib/core/facets/array/product.rb +1 -1
  24. data/lib/core/facets/binding/eval.rb +1 -1
  25. data/lib/core/facets/denumerable.rb +76 -0
  26. data/lib/core/facets/duplicable.rb +34 -0
  27. data/lib/core/facets/enumerable/count.rb +10 -4
  28. data/lib/core/facets/enumerable/defer.rb +77 -0
  29. data/lib/core/facets/enumerable/each_by.rb +1 -1
  30. data/lib/core/facets/enumerable/every.rb +35 -0
  31. data/lib/{more/facets/elementwise.rb → core/facets/enumerable/ewise.rb} +0 -0
  32. data/lib/core/facets/enumerable/filter.rb +25 -0
  33. data/lib/core/facets/enumerable/group_by.rb +1 -1
  34. data/lib/core/facets/enumerable/none.rb +3 -2
  35. data/lib/core/facets/enumerable/one.rb +3 -2
  36. data/lib/core/facets/enumerable/per.rb +61 -0
  37. data/lib/core/facets/exception/raised.rb +14 -0
  38. data/lib/core/facets/integer/odd.rb +5 -1
  39. data/lib/core/facets/kernel/__dir__.rb +13 -3
  40. data/lib/core/facets/kernel/__here__.rb +14 -0
  41. data/lib/core/facets/kernel/__method__.rb +9 -3
  42. data/lib/core/facets/kernel/ask.rb +1 -0
  43. data/lib/core/facets/kernel/equate.rb +13 -0
  44. data/lib/core/facets/kernel/extension.rb +9 -0
  45. data/lib/core/facets/kernel/identical.rb +4 -0
  46. data/lib/core/facets/kernel/instance_exec.rb +2 -1
  47. data/lib/core/facets/kernel/method.rb +49 -0
  48. data/lib/core/facets/kernel/object_send.rb +2 -2
  49. data/lib/core/facets/kernel/{state.rb → object_state.rb} +23 -12
  50. data/lib/core/facets/kernel/require_all.rb +6 -1
  51. data/lib/core/facets/kernel/require_local.rb +8 -1
  52. data/lib/core/facets/kernel/require_relative.rb +52 -0
  53. data/lib/core/facets/kernel/source_location.rb +13 -0
  54. data/lib/core/facets/kernel/tap.rb +13 -6
  55. data/lib/core/facets/module/attr_setter.rb +57 -0
  56. data/lib/core/facets/module/instance_method.rb +24 -0
  57. data/lib/core/facets/module/module_load.rb +60 -44
  58. data/lib/core/facets/module/module_require.rb +1 -0
  59. data/lib/core/facets/nilclass/to_f.rb +1 -1
  60. data/lib/core/facets/objectspace/op_fetch.rb +3 -0
  61. data/lib/core/facets/proc/curry.rb +4 -3
  62. data/lib/core/facets/string/bytes.rb +10 -4
  63. data/lib/core/facets/string/camelcase.rb +6 -5
  64. data/lib/core/facets/string/chars.rb +5 -1
  65. data/lib/core/facets/string/each_char.rb +1 -1
  66. data/lib/core/facets/string/each_word.rb +1 -1
  67. data/lib/core/facets/string/lines.rb +11 -4
  68. data/lib/core/facets/string/start_with.rb +9 -2
  69. data/lib/core/facets/string/unfold.rb +27 -0
  70. data/lib/core/facets/symbol/succ.rb +3 -3
  71. data/lib/core/facets/symbol/thrown.rb +20 -0
  72. data/lib/core/facets/symbol/to_proc.rb +3 -2
  73. data/lib/core/facets/time/to_time.rb +1 -1
  74. data/lib/core/facets/to_hash.rb +41 -100
  75. data/lib/core/facets/unboundmethod/name.rb +20 -23
  76. data/lib/more/facets/ansicode.rb +1 -10
  77. data/lib/more/facets/autoarray.rb +3 -31
  78. data/lib/more/facets/basicobject.rb +73 -0
  79. data/lib/more/facets/blankslate.rb +2 -66
  80. data/lib/{lore → more}/facets/cgi.rb +0 -0
  81. data/lib/more/facets/class_extend.rb +1 -0
  82. data/lib/{lore → more}/facets/continuation.rb +0 -0
  83. data/lib/{lore → more}/facets/date.rb +3 -3
  84. data/lib/more/facets/enumargs.rb +192 -0
  85. data/lib/more/facets/enumerablepass.rb +2 -216
  86. data/lib/more/facets/enumerator.rb +62 -0
  87. data/lib/more/facets/{equatable.rb → equitable.rb} +11 -11
  88. data/lib/more/facets/expirable.rb +13 -41
  89. data/lib/{lore → more}/facets/fileutils.rb +0 -0
  90. data/lib/{lore → more}/facets/fileutils/head.rb +0 -0
  91. data/lib/{lore → more}/facets/fileutils/safe_ln.rb +0 -0
  92. data/lib/{lore → more}/facets/fileutils/slice.rb +0 -0
  93. data/lib/{lore → more}/facets/fileutils/tail.rb +0 -0
  94. data/lib/{lore → more}/facets/fileutils/wc.rb +0 -0
  95. data/lib/{lore → more}/facets/fileutils/whereis.rb +0 -0
  96. data/lib/{lore → more}/facets/fileutils/which.rb +0 -0
  97. data/lib/{lore → more}/facets/getoptlong.rb +0 -0
  98. data/lib/more/facets/hook.rb +2 -29
  99. data/lib/more/facets/inheritor.rb +2 -2
  100. data/lib/more/facets/instance_eval.rb +50 -0
  101. data/lib/more/facets/instance_function.rb +78 -0
  102. data/lib/more/facets/main.rb +20 -15
  103. data/lib/more/facets/memoize.rb +1 -113
  104. data/lib/more/facets/module/attr.rb +83 -0
  105. data/lib/more/facets/module/attr_tester.rb +44 -0
  106. data/lib/more/facets/module/attr_toggler.rb +59 -0
  107. data/lib/more/facets/module/attr_validator.rb +34 -0
  108. data/lib/more/facets/{class_extension.rb → module/class_extend.rb} +21 -13
  109. data/lib/more/facets/once.rb +59 -0
  110. data/lib/more/facets/openmodule.rb +1 -0
  111. data/lib/more/facets/orderedhash.rb +1 -33
  112. data/lib/{lore → more}/facets/ostruct.rb +0 -0
  113. data/lib/more/facets/ostructable.rb +1 -4
  114. data/lib/more/facets/partial.rb +18 -16
  115. data/lib/{lore → more}/facets/pathname.rb +0 -0
  116. data/lib/more/facets/preinitialize.rb +157 -0
  117. data/lib/{lore → more}/facets/rbconfig.rb +0 -0
  118. data/lib/more/facets/recorder.rb +1 -2
  119. data/lib/{lore → more}/facets/set.rb +0 -0
  120. data/lib/{lore → more}/facets/shellwords.rb +0 -0
  121. data/lib/{lore → more}/facets/uri.rb +0 -0
  122. data/lib/{lore → more}/facets/yaml.rb +0 -0
  123. data/lib/{lore → more}/facets/zlib.rb +0 -0
  124. data/meta/loadpath +0 -1
  125. data/meta/sitemap +4 -0
  126. data/meta/version +1 -1
  127. data/test/core/enumerable/test_count.rb +1 -1
  128. data/test/{more/test_filter.rb → core/enumerable/test_defer.rb} +24 -22
  129. data/test/{more/test_elementor.rb → core/enumerable/test_every.rb} +2 -15
  130. data/test/core/enumerable/test_ewise.rb +23 -0
  131. data/test/core/enumerable/test_per.rb +18 -0
  132. data/test/core/enumerable/test_take.rb +13 -0
  133. data/test/core/kernel/test_deepcopy.rb +1 -1
  134. data/test/{more/test_1stclassmethod.rb → core/kernel/test_method.rb} +2 -7
  135. data/test/core/kernel/test_tap.rb +1 -1
  136. data/test/core/proc/test_curry.rb +11 -0
  137. data/test/core/string/test_bytes.rb +1 -1
  138. data/test/core/string/test_camelcase.rb +23 -6
  139. data/test/core/string/test_lines.rb +1 -1
  140. data/test/core/string/test_unfold.rb +14 -0
  141. data/test/{more → core}/test_blank.rb +0 -0
  142. data/test/{more → core}/test_boolean.rb +0 -0
  143. data/test/{more → core}/test_functor.rb +0 -0
  144. data/test/{lore → more}/test_basicobject.rb +0 -0
  145. data/test/more/{test_class_extension.rb → test_class_extend.rb} +6 -6
  146. data/test/{lore → more}/test_continuation.rb +0 -0
  147. data/test/{lore → more}/test_date.rb +0 -0
  148. data/test/more/{test_enumerablepass.rb → test_enumargs.rb} +2 -4
  149. data/test/more/{test_equatable.rb → test_equitable.rb} +2 -2
  150. data/test/more/{test_instantise.rb → test_instance_function.rb} +3 -2
  151. data/test/more/test_memoize.rb +1 -1
  152. data/test/{lore → more}/test_ostruct.rb +0 -0
  153. metadata +865 -1016
  154. data/RELEASE +0 -38
  155. data/doc/README.lore +0 -51
  156. data/doc/log/basic_stats/index.html +0 -39
  157. data/doc/log/changelog.html +0 -648
  158. data/doc/log/changelog.txt +0 -217
  159. data/doc/log/stats/index.html +0 -39
  160. data/doc/log/testlog.txt +0 -278
  161. data/doc/notes/CHANGES +0 -2529
  162. data/doc/rdoc/lore/classes/Array.html +0 -176
  163. data/doc/rdoc/lore/classes/CGI.html +0 -191
  164. data/doc/rdoc/lore/classes/Config.html +0 -135
  165. data/doc/rdoc/lore/classes/Continuation.html +0 -113
  166. data/doc/rdoc/lore/classes/Date.html +0 -631
  167. data/doc/rdoc/lore/classes/DateTime.html +0 -583
  168. data/doc/rdoc/lore/classes/Enumerable.html +0 -89
  169. data/doc/rdoc/lore/classes/Enumerable/Enumerator.html +0 -147
  170. data/doc/rdoc/lore/classes/File.html +0 -128
  171. data/doc/rdoc/lore/classes/FileUtils.html +0 -434
  172. data/doc/rdoc/lore/classes/GetoptLong.html +0 -118
  173. data/doc/rdoc/lore/classes/GetoptLong/DSL.html +0 -208
  174. data/doc/rdoc/lore/classes/Kernel.html +0 -135
  175. data/doc/rdoc/lore/classes/Logger.html +0 -229
  176. data/doc/rdoc/lore/classes/Logger/Ansicolor.html +0 -277
  177. data/doc/rdoc/lore/classes/Logger/LogDevice.html +0 -121
  178. data/doc/rdoc/lore/classes/NilClass.html +0 -119
  179. data/doc/rdoc/lore/classes/OpenStruct.html +0 -432
  180. data/doc/rdoc/lore/classes/Pathname.html +0 -353
  181. data/doc/rdoc/lore/classes/Set.html +0 -117
  182. data/doc/rdoc/lore/classes/Shellwords.html +0 -111
  183. data/doc/rdoc/lore/classes/String.html +0 -140
  184. data/doc/rdoc/lore/classes/Time.html +0 -154
  185. data/doc/rdoc/lore/classes/URI.html +0 -454
  186. data/doc/rdoc/lore/classes/URI/Hash.html +0 -105
  187. data/doc/rdoc/lore/classes/URI/Kernel.html +0 -122
  188. data/doc/rdoc/lore/classes/Zlib.html +0 -188
  189. data/doc/rdoc/lore/created.rid +0 -1
  190. data/doc/rdoc/lore/files/README.html +0 -286
  191. data/doc/rdoc/lore/files/doc/README_lore.html +0 -155
  192. data/doc/rdoc/lore/files/lib/lore/facets/basicobject_rb.html +0 -118
  193. data/doc/rdoc/lore/files/lib/lore/facets/cgi_rb.html +0 -111
  194. data/doc/rdoc/lore/files/lib/lore/facets/continuation_rb.html +0 -147
  195. data/doc/rdoc/lore/files/lib/lore/facets/date_rb.html +0 -97
  196. data/doc/rdoc/lore/files/lib/lore/facets/enumerator_rb.html +0 -111
  197. data/doc/rdoc/lore/files/lib/lore/facets/fileutils/head_rb.html +0 -96
  198. data/doc/rdoc/lore/files/lib/lore/facets/fileutils/safe_ln_rb.html +0 -96
  199. data/doc/rdoc/lore/files/lib/lore/facets/fileutils/slice_rb.html +0 -96
  200. data/doc/rdoc/lore/files/lib/lore/facets/fileutils/tail_rb.html +0 -96
  201. data/doc/rdoc/lore/files/lib/lore/facets/fileutils/wc_rb.html +0 -96
  202. data/doc/rdoc/lore/files/lib/lore/facets/fileutils/whereis_rb.html +0 -96
  203. data/doc/rdoc/lore/files/lib/lore/facets/fileutils/which_rb.html +0 -96
  204. data/doc/rdoc/lore/files/lib/lore/facets/fileutils_rb.html +0 -131
  205. data/doc/rdoc/lore/files/lib/lore/facets/getoptlong_rb.html +0 -135
  206. data/doc/rdoc/lore/files/lib/lore/facets/logger_rb.html +0 -142
  207. data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +0 -135
  208. data/doc/rdoc/lore/files/lib/lore/facets/pathname_rb.html +0 -145
  209. data/doc/rdoc/lore/files/lib/lore/facets/rbconfig_rb.html +0 -124
  210. data/doc/rdoc/lore/files/lib/lore/facets/set_rb.html +0 -96
  211. data/doc/rdoc/lore/files/lib/lore/facets/shellwords_rb.html +0 -124
  212. data/doc/rdoc/lore/files/lib/lore/facets/uri_rb.html +0 -125
  213. data/doc/rdoc/lore/files/lib/lore/facets/yaml_rb.html +0 -146
  214. data/doc/rdoc/lore/files/lib/lore/facets/zlib_rb.html +0 -97
  215. data/doc/rdoc/lore/fr_class_index.html +0 -73
  216. data/doc/rdoc/lore/fr_file_index.html +0 -71
  217. data/doc/rdoc/lore/fr_method_index.html +0 -177
  218. data/doc/rdoc/lore/index.html +0 -26
  219. data/doc/rdoc/lore/rdoc-style.css +0 -177
  220. data/doc/release-notes/RELEASE-2.0.5 +0 -8
  221. data/doc/release-notes/RELEASE-2.1.0 +0 -9
  222. data/doc/release-notes/RELEASE-2.1.1 +0 -5
  223. data/doc/release-notes/RELEASE-2.1.2 +0 -6
  224. data/doc/release-notes/RELEASE-2.1.3 +0 -5
  225. data/doc/release-notes/RELEASE-2.2.0 +0 -14
  226. data/doc/release-notes/RELEASE-2.2.1 +0 -4
  227. data/doc/release-notes/RELEASE-2.3.0 +0 -6
  228. data/doc/release-notes/RELEASE-2.4.0 +0 -70
  229. data/doc/release-notes/RELEASE-2.4.1 +0 -8
  230. data/doc/release-notes/RELEASE-2.4.2 +0 -4
  231. data/doc/release-notes/RELEASE-2.4.3 +0 -78
  232. data/doc/release-notes/RELEASE-2.4.4 +0 -38
  233. data/doc/release-notes/RELEASE-2.4.5 +0 -37
  234. data/doc/release-notes/RELEASE-2.5.0 +0 -83
  235. data/lib/core/facets/kernel/instance.rb +0 -19
  236. data/lib/lore/facets/basicobject.rb +0 -14
  237. data/lib/lore/facets/enumerator.rb +0 -67
  238. data/lib/lore/facets/logger.rb +0 -291
  239. data/lib/more/facets/1stclassmethod.rb +0 -140
  240. data/lib/more/facets/advisable.rb +0 -162
  241. data/lib/more/facets/association.rb +0 -210
  242. data/lib/more/facets/attr.rb +0 -209
  243. data/lib/more/facets/basex.rb +0 -37
  244. data/lib/more/facets/bbcode.rb +0 -397
  245. data/lib/more/facets/bicrypt.rb +0 -265
  246. data/lib/more/facets/binreadable.rb +0 -221
  247. data/lib/more/facets/censor.rb +0 -97
  248. data/lib/more/facets/classmethods.rb +0 -199
  249. data/lib/more/facets/consoleutils.rb +0 -99
  250. data/lib/more/facets/crypt.rb +0 -166
  251. data/lib/more/facets/dependency.rb +0 -151
  252. data/lib/more/facets/downloader.rb +0 -281
  253. data/lib/more/facets/duplicable.rb +0 -43
  254. data/lib/more/facets/elementor.rb +0 -133
  255. data/lib/more/facets/filter.rb +0 -121
  256. data/lib/more/facets/heap.rb +0 -22
  257. data/lib/more/facets/infinity.rb +0 -193
  258. data/lib/more/facets/ini.rb +0 -264
  259. data/lib/more/facets/instantise.rb +0 -1
  260. data/lib/more/facets/instantize.rb +0 -95
  261. data/lib/more/facets/interval.rb +0 -282
  262. data/lib/more/facets/iteration.rb +0 -65
  263. data/lib/more/facets/linkedlist.rb +0 -222
  264. data/lib/more/facets/lrucache.rb +0 -157
  265. data/lib/more/facets/matcher.rb +0 -140
  266. data/lib/more/facets/memoizer.rb +0 -74
  267. data/lib/more/facets/minitar.rb +0 -1063
  268. data/lib/more/facets/nackclass.rb +0 -41
  269. data/lib/more/facets/net/smtp_tls.rb +0 -131
  270. data/lib/more/facets/nilstatus.rb +0 -48
  271. data/lib/more/facets/overload.rb +0 -94
  272. data/lib/more/facets/paramix.rb +0 -202
  273. data/lib/more/facets/pool.rb +0 -91
  274. data/lib/more/facets/pqueue.rb +0 -449
  275. data/lib/more/facets/pry.rb +0 -32
  276. data/lib/more/facets/reflection.rb +0 -145
  277. data/lib/more/facets/semaphore.rb +0 -92
  278. data/lib/more/facets/settings.rb +0 -248
  279. data/lib/more/facets/snapshot.rb +0 -209
  280. data/lib/more/facets/sparse_array.rb +0 -809
  281. data/lib/more/facets/string/mask.rb +0 -278
  282. data/lib/more/facets/string/obfuscate.rb +0 -65
  283. data/lib/more/facets/string/stylize.rb +0 -169
  284. data/lib/more/facets/string/words.rb +0 -167
  285. data/lib/more/facets/syncarray.rb +0 -114
  286. data/lib/more/facets/synchash.rb +0 -157
  287. data/lib/more/facets/typecast.rb +0 -261
  288. data/lib/more/facets/uninheritable.rb +0 -50
  289. data/lib/more/facets/xmlhash.rb +0 -112
  290. data/lib/more/facets/xoxo.rb +0 -259
  291. data/lib/more/facets/ziputils.rb +0 -490
  292. data/task/conflicts +0 -63
  293. data/task/coverage.rake +0 -37
  294. data/task/methods +0 -49
  295. data/task/rdoc.rake +0 -17
  296. data/task/setup.rake +0 -38
  297. data/task/test.rake +0 -145
  298. data/test/more/test_advisable.rb +0 -71
  299. data/test/more/test_association.rb +0 -38
  300. data/test/more/test_bbcode.rb +0 -21
  301. data/test/more/test_binreadable.rb +0 -50
  302. data/test/more/test_buildable.rb +0 -73
  303. data/test/more/test_classmethods.rb +0 -56
  304. data/test/more/test_crypt.rb +0 -32
  305. data/test/more/test_dependency.rb +0 -69
  306. data/test/more/test_elementwise.rb +0 -25
  307. data/test/more/test_infinity.rb +0 -40
  308. data/test/more/test_interval.rb +0 -151
  309. data/test/more/test_linkedlist.rb +0 -41
  310. data/test/more/test_lrucache.rb +0 -14
  311. data/test/more/test_overload.rb +0 -160
  312. data/test/more/test_paramix.rb +0 -170
  313. data/test/more/test_prototype.rb +0 -35
  314. data/test/more/test_snapshot.rb +0 -21
  315. data/test/more/test_sparsearray.rb +0 -279
  316. data/test/more/test_syncarray.rb +0 -15
  317. data/test/more/test_synchash.rb +0 -16
  318. data/test/more/test_typecast.rb +0 -54
  319. data/test/more/test_uninheritable.rb +0 -31
  320. data/test/more/test_xoxo.rb +0 -274
  321. data/test/test_facets.rb +0 -9
@@ -0,0 +1,9 @@
1
+ = Requiring Facets
2
+
3
+ We should be able to require all the core libraries
4
+ by simply:
5
+
6
+ require 'facets'
7
+
8
+ QED.
9
+
@@ -1,20 +1,38 @@
1
1
  = Facets More Library
2
2
 
3
- http://facets.rubyforge.com
3
+ * http://facets.rubyforge.com
4
4
 
5
5
  "ALL YOUR BASE ARE BELONG TO RUBY"
6
6
 
7
7
 
8
8
  == Introduction
9
9
 
10
- On top of the extensive Core library, Facet provides a large collection of addational modules and classes.
10
+ On top of the extensive Core library, Facet provides a small collection
11
+ of additional modules and classes, as well as extended versions of
12
+ modules and classes in Ruby's Standard library.
11
13
 
12
14
 
13
15
  == Usage
14
16
 
15
- Use the More library like ou would any other 3rd party library. The only difference between Facets More library and other
16
- thrid party libraries is the lack of a enclosing @Facets::@ namespace. This is becuase the libraries provided by Facets
17
- are considerd fairly low-level. (Albeit there are a few exceptions.)
17
+ Use the More library like you would any other 3rd party library.
18
+ The only difference between Facets More library and other libraries
19
+ is the lack of any enclosing @Facets::@ namespace. This is becuase
20
+ the libraries provided by Facets are considerd fairly low-level.
21
+
22
+ When using Facets' extended versions of Ruby's standard libraries,
23
+ the More libraries have to loaded manually, of course. However you
24
+ do not need to load Ruby's library first, as the Facets' library
25
+ will do that automatically.
26
+
27
+ For example, normally one load Ruby's OpenStruct class via:
28
+
29
+ require 'ostruct'
30
+
31
+ To load 'ostruct.rb' plus Facets extensions for it simply use:
32
+
33
+ require 'facets/ostruct'
34
+
35
+ instead.
18
36
 
19
37
 
20
38
  == License
@@ -32,7 +50,7 @@ Acknowledgments and Copyrights for particular snippets of borrowed code are give
32
50
 
33
51
 
34
52
 
35
- ALL YOUR BASE ARE BELONG TO RUBY!
53
+ "ALL YOUR BASE ARE BELONG TO RUBY!"
36
54
 
37
55
 
38
56
  Ruby Facets, Copyright (c)2005,2006,2007,2008 Thomas Sawyer
@@ -0,0 +1,47 @@
1
+ # TomsLib - Tom's Ruby Support Library
2
+ # Copyright (c) 2002 Thomas Sawyer, LGPL
3
+ #
4
+ # About
5
+ # A plethora of modules, mixins and methods. Have fun!
6
+
7
+ # TomsLib is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU Lesser General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # TomsLib is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License
18
+ # along with TomsLib; if not, write to the Free Software
19
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+
21
+
22
+ module TomsLib
23
+
24
+ TITLE = "TomsLib"
25
+ RELEASE = "02.06.18"
26
+ STATUS = "UCC"
27
+ AUTHOR = "Thomas Sawyer"
28
+ EMAIL = "transami@transami.net"
29
+
30
+ Package = "#{TITLE}"
31
+ Version = "v#{RELEASE} #{STATUS}"
32
+ Copyright = "Copyright � 2002 #{AUTHOR}, #{EMAIL}"
33
+
34
+ def self.about
35
+ puts
36
+ puts TomsLib::Package
37
+ puts TomsLib::Version
38
+ puts TomsLib::Copyright
39
+ puts
40
+ end
41
+
42
+ end
43
+
44
+ # Write about info to standerd out
45
+ if $0 == __FILE__
46
+ TomsLib.about
47
+ end
@@ -0,0 +1,60 @@
1
+ = Annotations
2
+
3
+ A Complete In Code Annotations System
4
+ by Trans and George Moschovitis
5
+
6
+ http://facets.rubyforge.org
7
+
8
+ == Synopsis
9
+
10
+ Annotations provides a complete and easy to use system of annotating methods and arbitrary objects. The annotations are defined in-code,not in comments, so it is fully reflective without any preproccessing.
11
+
12
+ == What's New
13
+
14
+ This is Facets/Annotations first release as an independent project. As with all Facets' subprojects it is included in the complete facets package. So if you have 'facets' installed you do not need this.
15
+
16
+ Version 2.0+ is a major simplification over 1.0 series. Overall speed is much faster and the notation more consistant. Where before one would use "ann.attr_name.ann_name", now it's ann(:attr_name, :ann_name). This change was inspired by Ara T. Howard.
17
+
18
+ == Example
19
+
20
+ class X
21
+ attr :foo, String, :default => "bar"
22
+ end
23
+
24
+ X.ann :foo, :class #=> String
25
+ X.ann :foo, :default #=> "bar"
26
+
27
+ X.ann :foo, :default => "baz"
28
+
29
+ X.ann :foo, :default #=> "baz"
30
+
31
+ == Installation
32
+
33
+ IMPORTANT! This library is included in the complete facets package. You do not this library if you already have facets installed.
34
+
35
+ You can install either via gem or tarball.
36
+
37
+ gem install facets_annotations
38
+
39
+ or
40
+
41
+ wget http://rubyforge.org/frs/download.php/18317/facets_annotations-2.0.0.tgz
42
+ cd facets_annotations
43
+ sudo ruby setup.rb
44
+
45
+ == Documentation
46
+
47
+ Please see doc/ directory for additional documentation.
48
+
49
+ == Credit
50
+
51
+ Trans [Implementation]
52
+ George Moschovitis [Original Concept]
53
+ Ara T. Howard [Suggestions]
54
+
55
+ == License
56
+
57
+ Copyright (c) 2004-2007 Thomas Sawyer, George Moschovitis
58
+
59
+ Distributed under the Ruby/GPL dual-license.
60
+
@@ -0,0 +1,55 @@
1
+ = Facets Structures
2
+
3
+ http://facets.rubyforge.org
4
+
5
+ Facets Structures is a collection of data structure libraries..
6
+
7
+ == Libraries
8
+
9
+ === Associations
10
+
11
+ Gerenal binary association allows one object to be
12
+ associated with another. It has a variety of uses,
13
+ link-lists, simple ordered maps and mixed collections,
14
+ among them.
15
+
16
+ Associations can be used to draw simple relationships.
17
+
18
+ :Apple >> :Fruit
19
+ :Apple >> :Red
20
+ :Apple.associations #=> [ :Fruit, :Red ]
21
+
22
+ It can also be used for simple lists of ordered pairs.
23
+
24
+ c = [ :a >> 1, :b >> 2 ]
25
+ c.each { |k,v| puts "#{k} associated with #{v} }
26
+
27
+ produces
28
+
29
+ a associated with 1
30
+ b associated with 2
31
+
32
+ The method :>> is used to construct the association.
33
+ It is a rarely used method so it is generally available.
34
+ But you can't use an Association while extending
35
+ any of the following classes becuase they use #>> for
36
+ other things.
37
+
38
+ Bignum
39
+ Fixnum
40
+ Date
41
+ IPAddr
42
+ Process::Status
43
+
44
+
45
+ == Documentation
46
+
47
+ Please see web/doc/ directory for additional documentation.
48
+
49
+
50
+ == License
51
+
52
+ Facets
53
+ Copyright (c) 2004-2007 Thomas Sawyer
54
+ Distributed under the Ruby/GPL dual-license.
55
+
@@ -0,0 +1,101 @@
1
+ = Buildable
2
+
3
+ Block builder system.
4
+
5
+ by Trans
6
+
7
+ http://facets.rubyforge.org
8
+
9
+
10
+ == Synopsis
11
+
12
+ Buildable provides a library for creating your own block builders.
13
+
14
+
15
+ == Example
16
+
17
+ require 'facets/buildable'
18
+ require 'xmlhelper'
19
+
20
+ module XMLHelper
21
+ include Buildable
22
+ alias :build :element
23
+ end
24
+
25
+ doc = XMLHelper.build do
26
+ html do
27
+ head do
28
+ title "Test"
29
+ end
30
+ body do
31
+ i "Hello"
32
+ br
33
+ text "Test"
34
+ text "Hey"
35
+ end
36
+ end
37
+ end
38
+
39
+ doc.to_s
40
+
41
+ _produces_
42
+
43
+ <html><head><title>Test</title><body><i>Hello</i><br />TestHey</body></html>
44
+
45
+ The Buildable module is based on BuildingBlock class. The same effect can be achieved using it directly:
46
+
47
+ require 'facets'
48
+ require 'xmlhelper'
49
+
50
+ builder = BuildingBlock.new(XMLHelper, :element)
51
+
52
+ doc = builder.html do
53
+ head do
54
+ title "Test"
55
+ end
56
+ body do
57
+ i "Hello"
58
+ br
59
+ text "Test"
60
+ text "Hey"
61
+ end
62
+ end
63
+
64
+ doc.to_s
65
+
66
+
67
+ == Installation
68
+
69
+ IMPORTANT! This library is included in the complete facets package. You do not this library if you already have facets installed.
70
+
71
+ You can install either via gem:
72
+
73
+ gem install buildable
74
+
75
+ or manually via tarball:
76
+
77
+ wget http://rubyforge.org/frs/download.php/.../buildable-x.x.x.tgz
78
+ cd buildable-x.x.x
79
+ sudo util/setup
80
+
81
+
82
+ == Documentation
83
+
84
+ Please see doc/ directory for additional documentation.
85
+
86
+
87
+ == Upcoming Features
88
+
89
+ Better support for alternate output buffers.
90
+
91
+
92
+ == Credit
93
+
94
+ Trans
95
+
96
+
97
+ == License
98
+
99
+ Copyright (c) 2004-2007 Thomas Sawyer
100
+
101
+ Distributed under the Ruby/GPL dual-license.
@@ -0,0 +1,34 @@
1
+ = Facets Modeling
2
+
3
+ Facets Modeling is a collection of libraries to assist in object-oriented
4
+ modeling.
5
+
6
+ == Libraries
7
+
8
+ === Capsule
9
+
10
+ A module which is an instance of the Capsule class encapsulates in its scope
11
+ the top-level methods, top-level constants, and instance variables defined in
12
+ a ruby script file (and its subfiles) loaded by a ruby program. This allows
13
+ use of script files to define objects that can be loaded into a program in
14
+ much the same way that objects can be loaded from YAML or Marshal files.
15
+
16
+ See intro.txt[link:files/intro_txt.html] for an overview.
17
+
18
+
19
+ == Contact
20
+
21
+ facets-universal@rubyforge.org
22
+
23
+
24
+ == Install
25
+
26
+ gem install facets
27
+
28
+
29
+ == License
30
+
31
+ Facets
32
+ Copyright (c) 2004 Thomas Sawyer
33
+ Ruby License
34
+
@@ -0,0 +1,177 @@
1
+ = Command
2
+
3
+ Command provides a clean and easy way to create a command
4
+ line interface for your program. The unique technique
5
+ utlizes a Commandline to Object Mapping (COM) to make
6
+ it quick and easy.
7
+
8
+ == Synopsis
9
+
10
+ Let's make an executable called 'mycmd'.
11
+
12
+ #!/usr/bin/env ruby
13
+
14
+ require 'facets/console/command'
15
+
16
+ class MyCmd < Console::Command
17
+
18
+ def _v
19
+ $VERBOSE = true
20
+ end
21
+
22
+ def jump
23
+ if $VERBOSE
24
+ puts "JUMP! JUMP! JUMP!"
25
+ else
26
+ puts "Jump"
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ MyCmd.execute
33
+
34
+ Then on the command line:
35
+
36
+ % mycmd jump
37
+ Jump
38
+
39
+ % mycmd -v jump
40
+ JUMP! JUMP! JUMP!
41
+
42
+ == Subcommands
43
+
44
+ Commands can take subcommand and suboptions. To do this
45
+ simply add a module to your class with the same name
46
+ as the subcommand, in which the suboption methods are defined.
47
+
48
+ MyCmd << Console::Command
49
+
50
+ def initialize
51
+ @height = 1
52
+ end
53
+
54
+ def _v
55
+ $VERBOSE = true
56
+ end
57
+
58
+ def jump
59
+ if $VERBOSE
60
+ puts "JUMP!" * @height
61
+ else
62
+ puts "Jump" * @height
63
+ end
64
+ end
65
+
66
+ module Jump
67
+ def __height(h)
68
+ @height = h.to_i
69
+ end
70
+ end
71
+
72
+ end
73
+
74
+ MyCmd.start
75
+
76
+ Then on the command line:
77
+
78
+ % mycmd jump -h 2
79
+ Jump Jump
80
+
81
+ % mycmd -v jump -h 3
82
+ JUMP! JUMP! JUMP!
83
+
84
+ Another thing to notice about this example is that #start is an alias
85
+ for #execute.
86
+
87
+ == Missing Subcommands
88
+
89
+ You can use #method_missing to catch missing subcommand calls.
90
+
91
+ == Main and Default
92
+
93
+ If your command does not take subcommands then simply define
94
+ a #main method to dispatch action. All options will be treated globablly
95
+ in this case and any remaining comman-line arguments will be passed
96
+ to #main.
97
+
98
+ If on the other hand your command does take subcommands but none is given,
99
+ the #default method will be called, if defined. If not defined
100
+ an error will be raised (but only reported if $DEBUG is true).
101
+
102
+ == Global Options
103
+
104
+ You can define <i>global options</i> which are options that will be
105
+ processed no matter where they occur in the command line. In the above
106
+ examples only the options occuring before the subcommand are processed
107
+ globally. Anything occuring after the subcommand belonds strictly to
108
+ the subcommand. For instance, if we had added the following to the above
109
+ example:
110
+
111
+ global_option :_v
112
+
113
+ Then -v could appear anywhere in the command line, even on the end,
114
+ and still work as expected.
115
+
116
+ % mycmd jump -h 3 -v
117
+
118
+ == Missing Options
119
+
120
+ You can use #option_missing to catch any options that are not explicility
121
+ defined.
122
+
123
+ The method signature should look like:
124
+
125
+ option_missing(option_name, args)
126
+
127
+ Example:
128
+ def option_missing(option_name, args)
129
+ p args if $debug
130
+ case option_name
131
+ when 'p'
132
+ @a = args[0].to_i
133
+ @b = args[1].to_i
134
+ 2
135
+ else
136
+ raise InvalidOptionError(option_name, args)
137
+ end
138
+ end
139
+
140
+ Its return value should be the effective "arity" of that options -- that is,
141
+ how many arguments it consumed ("-p a b", for example, would consume 2 args:
142
+ "a" and "b"). An arity of 1 is assumed if nil or false is returned.
143
+
144
+ Be aware that when using subcommand modules, the same option_missing
145
+ method will catch missing options for global options and subcommand
146
+ options too unless an option_missing method is also defined in the
147
+ subcommand module.
148
+
149
+ == Help Documentation
150
+
151
+ You can also add help information quite easily. If the following code
152
+ is saved as 'foo' for instance.
153
+
154
+ MyCmd << Console::Command
155
+
156
+ help "Dispays the word JUMP!"
157
+
158
+ def jump
159
+ if $VERBOSE
160
+ puts "JUMP! JUMP! JUMP!"
161
+ else
162
+ puts "Jump"
163
+ end
164
+ end
165
+
166
+ end
167
+
168
+ MyCmd.execute
169
+
170
+ then by running 'foo help' on the command line, standard help information
171
+ will be displayed.
172
+
173
+ foo
174
+
175
+ jump Displays the word JUMP!
176
+
177
+