facets 2.4.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (293) hide show
  1. data/AUTHORS +1 -1
  2. data/CHANGES +25 -5
  3. data/MANIFEST +67 -34
  4. data/METADATA +2 -2
  5. data/NEWS +54 -46
  6. data/doc/news/NEWS-2.4.0 +52 -0
  7. data/doc/rdoc/core/classes/Array.html +198 -198
  8. data/doc/rdoc/core/classes/Binding.html +86 -192
  9. data/doc/rdoc/core/classes/Class.html +136 -136
  10. data/doc/rdoc/core/classes/Comparable.html +45 -45
  11. data/doc/rdoc/core/classes/Dir.html +64 -64
  12. data/doc/rdoc/core/classes/Enumerable.html +287 -281
  13. data/doc/rdoc/core/classes/Exception.html +16 -16
  14. data/doc/rdoc/core/classes/FalseClass.html +8 -8
  15. data/doc/rdoc/core/classes/File.html +100 -100
  16. data/doc/rdoc/core/classes/FileTest.html +8 -8
  17. data/doc/rdoc/core/classes/Float.html +32 -32
  18. data/doc/rdoc/core/classes/Friend.html +8 -8
  19. data/doc/rdoc/core/classes/Functor.html +12 -12
  20. data/doc/rdoc/core/classes/Hash.html +439 -847
  21. data/doc/rdoc/{more → core}/classes/Indexable.html +115 -115
  22. data/doc/rdoc/core/classes/InstanceVariables.html +88 -88
  23. data/doc/rdoc/core/classes/Integer.html +142 -142
  24. data/doc/rdoc/core/classes/Kernel.html +602 -600
  25. data/doc/rdoc/core/classes/Lazy/Promise.html +1 -1
  26. data/doc/rdoc/core/classes/MatchData.html +30 -30
  27. data/doc/rdoc/core/classes/Module.html +379 -327
  28. data/doc/rdoc/core/classes/NilClass.html +32 -32
  29. data/doc/rdoc/core/classes/Numeric.html +46 -46
  30. data/doc/rdoc/core/classes/Object.html +4 -4
  31. data/doc/rdoc/core/classes/Proc.html +46 -134
  32. data/doc/rdoc/core/classes/Range.html +60 -60
  33. data/doc/rdoc/core/classes/Regexp.html +28 -28
  34. data/doc/rdoc/{more → core}/classes/Stackable.html +38 -38
  35. data/doc/rdoc/core/classes/String.html +844 -504
  36. data/doc/rdoc/core/classes/Symbol.html +62 -62
  37. data/doc/rdoc/core/classes/Time.html +112 -112
  38. data/doc/rdoc/core/classes/TrueClass.html +8 -8
  39. data/doc/rdoc/core/classes/UnboundMethod.html +22 -22
  40. data/doc/rdoc/core/created.rid +1 -1
  41. data/doc/rdoc/core/files/lib/core/facets/array_rb.html +4 -1
  42. data/doc/rdoc/core/files/lib/core/facets/binding_rb.html +1 -1
  43. data/doc/rdoc/core/files/lib/core/facets/boolean_rb.html +2 -2
  44. data/doc/rdoc/core/files/lib/core/facets/class/methodize_rb.html +96 -0
  45. data/doc/rdoc/core/files/lib/core/facets/class/pathize_rb.html +96 -0
  46. data/doc/rdoc/core/files/lib/core/facets/class_rb.html +5 -1
  47. data/doc/rdoc/core/files/lib/core/facets/dir_rb.html +1 -1
  48. data/doc/rdoc/core/files/lib/core/facets/{class/to_methodname_rb.html → enumerable/commonality_rb.html} +4 -4
  49. data/doc/rdoc/core/files/lib/core/facets/enumerable/entropy_rb.html +96 -0
  50. data/doc/rdoc/core/files/lib/core/facets/{class/to_pathname_rb.html → enumerable/frequency_rb.html} +4 -4
  51. data/doc/rdoc/core/files/lib/core/facets/enumerable/probability_rb.html +1 -1
  52. data/doc/rdoc/core/files/lib/core/facets/enumerable_rb.html +6 -2
  53. data/doc/rdoc/core/files/lib/core/facets/file_rb.html +2 -1
  54. data/doc/rdoc/core/files/lib/core/facets/hash_rb.html +7 -1
  55. data/doc/rdoc/{more/files/lib/more → core/files/lib/core}/facets/indexable_rb.html +2 -2
  56. data/doc/rdoc/core/files/lib/core/facets/kernel/require_all_rb.html +92 -0
  57. data/doc/rdoc/core/files/lib/core/facets/kernel/require_local_rb.html +92 -0
  58. data/doc/rdoc/core/files/lib/core/facets/kernel_rb.html +15 -2
  59. data/doc/rdoc/core/files/lib/core/facets/module/integrate_rb.html +96 -0
  60. data/doc/rdoc/core/files/lib/core/facets/module/methodize_rb.html +96 -0
  61. data/doc/rdoc/core/files/lib/core/facets/module/module_load_rb.html +1 -1
  62. data/doc/rdoc/core/files/lib/core/facets/module/pathize_rb.html +5 -1
  63. data/doc/rdoc/core/files/lib/core/facets/module/redefine_method_rb.html +92 -0
  64. data/doc/rdoc/core/files/lib/core/facets/module/redirect_method_rb.html +92 -0
  65. data/doc/rdoc/core/files/lib/core/facets/module/rename_method_rb.html +92 -0
  66. data/doc/rdoc/core/files/lib/core/facets/module/revise_rb.html +8 -1
  67. data/doc/rdoc/core/files/lib/core/facets/module/wrap_method_rb.html +92 -0
  68. data/doc/rdoc/core/files/lib/core/facets/module_rb.html +8 -5
  69. data/doc/rdoc/core/files/lib/core/facets/numeric_rb.html +2 -1
  70. data/doc/rdoc/core/files/lib/core/facets/proc_rb.html +3 -5
  71. data/doc/rdoc/{more/files/lib/more → core/files/lib/core}/facets/stackable_rb.html +3 -4
  72. data/doc/rdoc/core/files/lib/core/facets/string/each_word_rb.html +96 -0
  73. data/doc/rdoc/core/files/lib/core/facets/{module/clone_rb.html → string/methodize_rb.html} +4 -4
  74. data/doc/rdoc/core/files/lib/core/facets/{kernel/load_rb.html → string/pathize_rb.html} +4 -4
  75. data/doc/rdoc/core/files/lib/core/facets/string/word_wrap_rb.html +92 -0
  76. data/doc/rdoc/core/files/lib/core/facets/string/words_rb.html +1 -5
  77. data/doc/rdoc/core/files/lib/core/facets/string_rb.html +8 -3
  78. data/doc/rdoc/core/files/lib/core/facets/symbol_rb.html +2 -1
  79. data/doc/rdoc/core/fr_class_index.html +2 -3
  80. data/doc/rdoc/core/fr_file_index.html +36 -16
  81. data/doc/rdoc/core/fr_method_index.html +778 -784
  82. data/doc/rdoc/lore/created.rid +1 -1
  83. data/doc/rdoc/more/classes/ANSICode.html +66 -66
  84. data/doc/rdoc/more/classes/Advisable.html +37 -37
  85. data/doc/rdoc/more/classes/Advisable/Method.html +20 -20
  86. data/doc/rdoc/more/classes/Archive/Tar/Minitar.html +27 -27
  87. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Input.html +28 -28
  88. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Output.html +19 -19
  89. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Reader.html +31 -31
  90. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Writer.html +33 -33
  91. data/doc/rdoc/more/classes/Association.html +28 -28
  92. data/doc/rdoc/more/classes/Association/Kernel.html +8 -8
  93. data/doc/rdoc/more/classes/Autoarray.html +12 -12
  94. data/doc/rdoc/more/classes/BBCode.html +34 -34
  95. data/doc/rdoc/more/classes/BaseX.html +16 -16
  96. data/doc/rdoc/more/classes/BiCrypt.html +67 -67
  97. data/doc/rdoc/more/classes/BigDuration.html +30 -30
  98. data/doc/rdoc/more/classes/BinReadable.html +85 -85
  99. data/doc/rdoc/more/classes/BinReadable/ByteOrder.html +25 -25
  100. data/doc/rdoc/more/classes/Binding.html +201 -0
  101. data/doc/rdoc/more/classes/Buildable.html +4 -4
  102. data/doc/rdoc/more/classes/BuildingBlock.html +32 -32
  103. data/doc/rdoc/more/classes/CLI.html +108 -0
  104. data/doc/rdoc/more/classes/CLI/Arguments.html +76 -76
  105. data/doc/rdoc/more/classes/CLI/Command.html +22 -22
  106. data/doc/rdoc/more/classes/CLI/NoCommandError.html +4 -4
  107. data/doc/rdoc/more/classes/CLI/NoOptionError.html +4 -4
  108. data/doc/rdoc/more/classes/CacheDecorator.html +21 -21
  109. data/doc/rdoc/more/classes/Capsule.html +41 -41
  110. data/doc/rdoc/more/classes/Chain.html +17 -17
  111. data/doc/rdoc/more/classes/Cloneable.html +4 -4
  112. data/doc/rdoc/more/classes/ConsoleUtils.html +18 -18
  113. data/doc/rdoc/more/classes/Coroutine.html +28 -28
  114. data/doc/rdoc/more/classes/Crypt.html +16 -16
  115. data/doc/rdoc/more/classes/CssFilter.html +45 -45
  116. data/doc/rdoc/more/classes/CssTree.html +8 -8
  117. data/doc/rdoc/more/classes/Dictionary.html +228 -228
  118. data/doc/rdoc/more/classes/DictionaryMatcher.html +38 -38
  119. data/doc/rdoc/more/classes/DictionaryMatcher/MatchData.html +4 -4
  120. data/doc/rdoc/more/classes/Downloader.html +56 -56
  121. data/doc/rdoc/more/classes/Duration.html +68 -68
  122. data/doc/rdoc/more/classes/Enumerable.html +44 -44
  123. data/doc/rdoc/more/classes/Enumerable/Elementor.html +16 -16
  124. data/doc/rdoc/more/classes/Enumerable/Enumerator.html +4 -4
  125. data/doc/rdoc/more/classes/EnumerablePass.html +15 -15
  126. data/doc/rdoc/more/classes/Equatable.html +16 -16
  127. data/doc/rdoc/more/classes/EventHook.html +8 -8
  128. data/doc/rdoc/more/classes/Expirable.html +17 -17
  129. data/doc/rdoc/more/classes/FileList.html +125 -125
  130. data/doc/rdoc/more/classes/FileShell.html +147 -147
  131. data/doc/rdoc/more/classes/Fileable.html +14 -14
  132. data/doc/rdoc/more/classes/Fileable/DSL.html +41 -41
  133. data/doc/rdoc/more/classes/Hash.html +306 -14
  134. data/doc/rdoc/more/classes/Hash2Xml.html +4 -4
  135. data/doc/rdoc/more/classes/HtmlFilter.html +9 -9
  136. data/doc/rdoc/more/classes/IORedirect.html +19 -19
  137. data/doc/rdoc/more/classes/InfinityClass.html +36 -36
  138. data/doc/rdoc/more/classes/InfinityClass/Numeric.html +23 -23
  139. data/doc/rdoc/more/classes/Ini.html +37 -37
  140. data/doc/rdoc/more/classes/Instantiable.html +9 -9
  141. data/doc/rdoc/more/classes/Instantise.html +8 -8
  142. data/doc/rdoc/more/classes/Interval.html +187 -187
  143. data/doc/rdoc/more/classes/It.html +12 -12
  144. data/doc/rdoc/more/classes/Kernel.html +77 -77
  145. data/doc/rdoc/more/classes/LRUCache.html +38 -38
  146. data/doc/rdoc/more/classes/LinkedList.html +68 -68
  147. data/doc/rdoc/more/classes/LinkedList/Node.html +4 -4
  148. data/doc/rdoc/{core → more}/classes/MissingArgument.html +1 -2
  149. data/doc/rdoc/more/classes/Module.html +171 -171
  150. data/doc/rdoc/more/classes/Multiton.html +12 -12
  151. data/doc/rdoc/more/classes/Multiton/MetaMethods.html +28 -28
  152. data/doc/rdoc/more/classes/Net/SMTP.html +19 -19
  153. data/doc/rdoc/more/classes/NullClass.html +24 -24
  154. data/doc/rdoc/more/classes/ObjectReflection.html +12 -12
  155. data/doc/rdoc/more/classes/OpEsc.html +5 -5
  156. data/doc/rdoc/more/classes/OpenCascade.html +4 -4
  157. data/doc/rdoc/more/classes/OpenCollection.html +8 -8
  158. data/doc/rdoc/more/classes/OpenHash.html +9 -9
  159. data/doc/rdoc/more/classes/OpenObject.html +95 -95
  160. data/doc/rdoc/more/classes/PQueue.html +84 -84
  161. data/doc/rdoc/more/classes/Paramix.html +11 -11
  162. data/doc/rdoc/more/classes/Paramix/Delegator.html +16 -16
  163. data/doc/rdoc/more/classes/PathList.html +8 -8
  164. data/doc/rdoc/more/classes/PathList/Finder.html +8 -8
  165. data/doc/rdoc/more/classes/Platform.html +46 -46
  166. data/doc/rdoc/more/classes/Pool.html +18 -18
  167. data/doc/rdoc/more/classes/Proc.html +48 -4
  168. data/doc/rdoc/more/classes/ProgressBar.html +52 -52
  169. data/doc/rdoc/more/classes/Prototype.html +28 -28
  170. data/doc/rdoc/more/classes/RWDelegator.html +16 -16
  171. data/doc/rdoc/more/classes/Random.html +9 -9
  172. data/doc/rdoc/more/classes/Random/Array.html +37 -37
  173. data/doc/rdoc/more/classes/Random/Hash.html +52 -52
  174. data/doc/rdoc/more/classes/Random/Object.html +4 -4
  175. data/doc/rdoc/more/classes/Random/String.html +34 -34
  176. data/doc/rdoc/more/classes/Random/String/Self.html +9 -9
  177. data/doc/rdoc/more/classes/Recorder.html +16 -16
  178. data/doc/rdoc/more/classes/Reference.html +19 -19
  179. data/doc/rdoc/more/classes/Registerable.html +13 -13
  180. data/doc/rdoc/more/classes/Semaphore.html +36 -36
  181. data/doc/rdoc/more/classes/Settings.html +28 -28
  182. data/doc/rdoc/more/classes/Settings/Setting.html +13 -13
  183. data/doc/rdoc/more/classes/Settings/SettingCollection.html +4 -4
  184. data/doc/rdoc/more/classes/SimpleStringIO.html +8 -8
  185. data/doc/rdoc/more/classes/Snapshot.html +16 -16
  186. data/doc/rdoc/more/classes/Snapshot/ValueHolder.html +12 -12
  187. data/doc/rdoc/more/classes/String/Style.html +113 -113
  188. data/doc/rdoc/{core → more}/classes/String/Words.html +78 -78
  189. data/doc/rdoc/more/classes/Struct.html +8 -8
  190. data/doc/rdoc/more/classes/SyncArray.html +4 -4
  191. data/doc/rdoc/more/classes/SyncHash.html +4 -4
  192. data/doc/rdoc/more/classes/SyncHash/Delegator.html +28 -28
  193. data/doc/rdoc/more/classes/SyncHash/Inheritor.html +28 -28
  194. data/doc/rdoc/more/classes/System.html +253 -253
  195. data/doc/rdoc/more/classes/Timer.html +48 -48
  196. data/doc/rdoc/more/classes/Timer/Dummy.html +9 -9
  197. data/doc/rdoc/more/classes/TracePoint.html +64 -62
  198. data/doc/rdoc/more/classes/Tuple.html +170 -170
  199. data/doc/rdoc/more/classes/TypeCast/Class.html +4 -4
  200. data/doc/rdoc/more/classes/TypeCast/Object.html +4 -4
  201. data/doc/rdoc/more/classes/Uninheritable.html +6 -6
  202. data/doc/rdoc/more/classes/UploadUtils.html +49 -49
  203. data/doc/rdoc/more/classes/VersionNumber.html +53 -53
  204. data/doc/rdoc/more/classes/Weekdays.html +28 -28
  205. data/doc/rdoc/more/classes/XOXO.html +9 -9
  206. data/doc/rdoc/more/classes/ZipUtils.html +58 -58
  207. data/doc/rdoc/more/classes/ZipUtils/DryRun.html +28 -28
  208. data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +28 -28
  209. data/doc/rdoc/more/classes/ZipUtils/Verbose.html +28 -28
  210. data/doc/rdoc/more/created.rid +1 -1
  211. data/doc/rdoc/more/files/lib/more/facets/ansicode_rb.html +1 -1
  212. data/doc/rdoc/{core/files/lib/core → more/files/lib/more}/facets/binding/opvars_rb.html +2 -2
  213. data/doc/rdoc/{core/files/lib/core → more/files/lib/more}/facets/hash/stringify_keys_rb.html +2 -2
  214. data/doc/rdoc/{core/files/lib/core → more/files/lib/more}/facets/hash/symbolize_keys_rb.html +2 -2
  215. data/doc/rdoc/{core/files/lib/core/facets/proc → more/files/lib/more/facets}/partial_rb.html +8 -7
  216. data/doc/rdoc/more/files/lib/more/facets/snapshot_rb.html +2 -2
  217. data/doc/rdoc/more/files/lib/more/facets/string/words_rb.html +96 -0
  218. data/doc/rdoc/more/files/lib/more/facets/tracepoint_rb.html +13 -8
  219. data/doc/rdoc/more/fr_class_index.html +4 -2
  220. data/doc/rdoc/more/fr_file_index.html +9 -2
  221. data/doc/rdoc/more/fr_method_index.html +1013 -1009
  222. data/doc/ri/CLI/cdesc-CLI.yaml +7 -2
  223. data/doc/ri/Enumerable/probability-i.yaml +1 -1
  224. data/doc/ri/Module/append_features-i.yaml +4 -3
  225. data/doc/ri/Module/cdesc-Module.yaml +4 -3
  226. data/doc/ri/Module/methodize-i.yaml +14 -0
  227. data/doc/ri/Module/redefine_method-i.yaml +1 -1
  228. data/doc/ri/Module/redirect_method-i.yaml +3 -1
  229. data/doc/ri/Module/rename_method-i.yaml +1 -1
  230. data/doc/ri/created.rid +1 -1
  231. data/lib/core/facets/array.rb +3 -0
  232. data/lib/core/facets/binding.rb +0 -1
  233. data/lib/core/facets/class.rb +4 -4
  234. data/lib/core/facets/class/{to_methodname.rb → methodize.rb} +5 -2
  235. data/lib/core/facets/class/pathize.rb +14 -0
  236. data/lib/core/facets/enumerable.rb +5 -2
  237. data/lib/core/facets/enumerable/commonality.rb +33 -0
  238. data/lib/core/facets/enumerable/entropy.rb +37 -0
  239. data/lib/core/facets/enumerable/frequency.rb +18 -0
  240. data/lib/core/facets/enumerable/probability.rb +1 -98
  241. data/lib/core/facets/file.rb +1 -1
  242. data/lib/core/facets/hash.rb +6 -0
  243. data/lib/{more → core}/facets/indexable.rb +0 -0
  244. data/lib/core/facets/kernel.rb +15 -1
  245. data/lib/core/facets/kernel/require_all.rb +21 -0
  246. data/lib/core/facets/kernel/{load.rb → require_local.rb} +6 -23
  247. data/lib/core/facets/module.rb +7 -3
  248. data/lib/core/facets/module/integrate.rb +2 -0
  249. data/lib/core/facets/module/methodize.rb +14 -0
  250. data/lib/core/facets/module/pathize.rb +10 -7
  251. data/lib/core/facets/module/redefine_method.rb +35 -0
  252. data/lib/core/facets/module/redirect_method.rb +45 -0
  253. data/lib/core/facets/module/rename_method.rb +20 -0
  254. data/lib/core/facets/module/revise.rb +7 -113
  255. data/lib/core/facets/module/wrap_method.rb +28 -0
  256. data/lib/core/facets/numeric.rb +1 -1
  257. data/lib/core/facets/proc.rb +2 -3
  258. data/lib/{more → core}/facets/stackable.rb +0 -0
  259. data/lib/core/facets/string.rb +8 -6
  260. data/lib/core/facets/string/each_word.rb +13 -0
  261. data/lib/core/facets/string/methodize.rb +12 -0
  262. data/lib/core/facets/string/pathize.rb +12 -0
  263. data/lib/core/facets/string/word_wrap.rb +34 -0
  264. data/lib/core/facets/string/words.rb +6 -167
  265. data/lib/core/facets/symbol.rb +1 -0
  266. data/lib/more/facets/ansicode.rb +4 -4
  267. data/lib/{core → more}/facets/binding/opvars.rb +0 -0
  268. data/lib/{core → more}/facets/hash/stringify_keys.rb +0 -0
  269. data/lib/{core → more}/facets/hash/symbolize_keys.rb +5 -6
  270. data/lib/{core/facets/proc → more/facets}/partial.rb +0 -0
  271. data/lib/more/facets/string/words.rb +173 -0
  272. data/test/core/dir/test_multiglob.rb +1 -0
  273. data/test/core/dir/test_recurse.rb +1 -0
  274. data/test/core/enumerable/test_commonality.rb +15 -0
  275. data/test/core/enumerable/test_entropy.rb +15 -0
  276. data/test/core/enumerable/test_frequency.rb +11 -0
  277. data/test/core/enumerable/test_probability.rb +1 -34
  278. data/test/core/string/test_each_word.rb +14 -0
  279. data/test/core/string/test_fold.rb +1 -1
  280. data/test/core/string/test_word_wrap.rb +35 -0
  281. data/test/core/string/test_words.rb +12 -61
  282. data/test/more/test_command.rb +7 -9
  283. data/test/more/test_paramix.rb +4 -1
  284. data/test/{core/proc → more}/test_partial.rb +1 -1
  285. metadata +75 -38
  286. data/doc/rdoc/core/classes/Module/CloneExtensions.html +0 -287
  287. data/doc/ri/Module/CloneExtensions/cdesc-CloneExtensions.yaml +0 -20
  288. data/doc/ri/Module/CloneExtensions/clone_removing-i.yaml +0 -14
  289. data/doc/ri/Module/CloneExtensions/clone_renaming-i.yaml +0 -14
  290. data/doc/ri/Module/CloneExtensions/clone_using-i.yaml +0 -14
  291. data/lib/core/facets/class/to_pathname.rb +0 -12
  292. data/lib/core/facets/module/clone.rb +0 -57
  293. data/test/core/module/test_clone.rb +0 -45
File without changes
@@ -1,31 +1,45 @@
1
+ require 'facets/kernel/__class__.rb'
1
2
  require 'facets/kernel/__dir__.rb'
2
3
  require 'facets/kernel/__get__.rb'
3
4
  require 'facets/kernel/__set__.rb'
4
5
  require 'facets/kernel/as.rb'
6
+ require 'facets/kernel/ask.rb'
7
+ require 'facets/kernel/attr_singleton.rb'
5
8
  require 'facets/kernel/complete.rb'
6
9
  require 'facets/kernel/constant.rb'
7
10
  require 'facets/kernel/d.rb'
8
11
  require 'facets/kernel/deep_copy.rb'
12
+ require 'facets/kernel/demo.rb'
9
13
  require 'facets/kernel/ergo.rb'
10
14
  require 'facets/kernel/here.rb'
15
+ require 'facets/kernel/in.rb'
16
+ require 'facets/kernel/instance.rb'
11
17
  require 'facets/kernel/instance_assign.rb' # DEPRECATE
12
18
  require 'facets/kernel/instance_class.rb'
13
19
  require 'facets/kernel/instance_send.rb'
14
- require 'facets/kernel/load.rb'
20
+ require 'facets/kernel/instance_variables.rb'
21
+ require 'facets/kernel/maybe.rb'
15
22
  require 'facets/kernel/not_nil.rb'
16
23
  require 'facets/kernel/object_class.rb'
17
24
  require 'facets/kernel/object_hexid.rb'
18
25
  require 'facets/kernel/object_send.rb'
19
26
  require 'facets/kernel/p.rb'
20
27
  require 'facets/kernel/populate.rb'
28
+ require 'facets/kernel/require_all.rb'
29
+ require 'facets/kernel/require_local.rb'
21
30
  require 'facets/kernel/resc.rb'
22
31
  require 'facets/kernel/respond.rb'
32
+ require 'facets/kernel/returning.rb'
23
33
  require 'facets/kernel/silence.rb'
24
34
  require 'facets/kernel/singleton_class.rb'
25
35
  require 'facets/kernel/suppress.rb'
26
36
  require 'facets/kernel/tap.rb'
37
+ require 'facets/kernel/try.rb'
38
+ require 'facets/kernel/val.rb'
27
39
  require 'facets/kernel/with.rb'
28
40
 
41
+ # for 1.9
29
42
  require 'facets/kernel/__callee__.rb'
30
43
  require 'facets/kernel/__method__.rb'
44
+ require 'facets/kernel/instance_exec.rb'
31
45
 
@@ -0,0 +1,21 @@
1
+ module Kernel
2
+
3
+ # Require a pattern of files. This make is easy
4
+ # to require an entire directory, for instance.
5
+ #
6
+ # require_all 'facets/time/*'
7
+ #
8
+ def require_all(pat)
9
+ $LOAD_PATH.each do |path|
10
+ fs = Dir[File.join(path,pat)]
11
+ unless fs.empty?
12
+ fs.each { |f|
13
+ Kernel.require( f ) unless File.directory?( f )
14
+ }
15
+ break;
16
+ end
17
+ end
18
+ end
19
+
20
+ end
21
+
@@ -1,15 +1,5 @@
1
1
  module Kernel
2
2
 
3
- # Load file from same dir as calling script.
4
- #
5
- # load_local 'templib'
6
- #
7
- def load_local(fname, safe=nil)
8
- #fdir = File.expand_path( File.dirname( caller[0] ) )
9
- fdir = File.dirname( caller[0] )
10
- load( File.join( fdir, fname ), safe )
11
- end
12
-
13
3
  # Require file from same dir as calling script.
14
4
  #
15
5
  # require_local 'templib'
@@ -20,21 +10,14 @@ module Kernel
20
10
  require( File.join( fdir, fname ) )
21
11
  end
22
12
 
23
- # Require a pattern of files. This make is easy
24
- # to require an entire directory, for instance.
13
+ # Load file from same dir as calling script.
25
14
  #
26
- # require_all 'facets/time/*'
15
+ # load_local 'templib'
27
16
  #
28
- def require_all(pat)
29
- $LOAD_PATH.each do |path|
30
- fs = Dir[File.join(path,pat)]
31
- unless fs.empty?
32
- fs.each { |f|
33
- Kernel.require( f ) unless File.directory?( f )
34
- }
35
- break;
36
- end
37
- end
17
+ def load_local(fname, safe=nil)
18
+ #fdir = File.expand_path( File.dirname( caller[0] ) )
19
+ fdir = File.dirname( caller[0] )
20
+ load( File.join( fdir, fname ), safe )
38
21
  end
39
22
 
40
23
  end
@@ -1,20 +1,24 @@
1
- #require 'facets/module/abstract.rb'
1
+ require 'facets/module/abstract.rb'
2
2
  require 'facets/module/alias.rb'
3
3
  require 'facets/module/ancestor.rb'
4
4
  require 'facets/module/basename.rb'
5
5
  require 'facets/module/can.rb'
6
6
  require 'facets/module/class.rb'
7
- #require 'facets/module/clone.rb'
8
7
  require 'facets/module/conflict.rb'
9
8
  require 'facets/module/include_function_module.rb'
10
9
  require 'facets/module/instance_methods.rb'
11
10
  require 'facets/module/is.rb'
11
+ require 'facets/module/methodize.rb'
12
12
  require 'facets/module/modspace.rb'
13
- #require 'facets/module/module_load.rb'
13
+ require 'facets/module/module_load.rb'
14
14
  require 'facets/module/nesting.rb'
15
15
  require 'facets/module/op.rb'
16
16
  require 'facets/module/pathize.rb'
17
17
  require 'facets/module/prepend.rb'
18
+ require 'facets/module/redefine_method'
19
+ require 'facets/module/redirect_method'
20
+ require 'facets/module/rename_method'
18
21
  require 'facets/module/revise.rb'
19
22
  require 'facets/module/spacename.rb'
23
+ require 'facets/module/wrap_method.rb'
20
24
 
@@ -0,0 +1,2 @@
1
+ require 'facets/module/revise'
2
+
@@ -0,0 +1,14 @@
1
+ require 'facets/string/methodize'
2
+
3
+ class Module
4
+
5
+ # Translate a module name to a suitable method name.
6
+ #
7
+ # My::CoolClass.methodize => "my__cool_class"
8
+ #
9
+ def methodize
10
+ name.methodize
11
+ end
12
+
13
+ end
14
+
@@ -1,3 +1,5 @@
1
+ require 'facets/string/pathize'
2
+
1
3
  class Module
2
4
 
3
5
  # Converts a class name to a unix path
@@ -5,14 +7,15 @@ class Module
5
7
  # Examples
6
8
  # CoolClass.pathize #=> "cool_class"
7
9
  # My::CoolClass.pathize #=> "my/cool_class"
8
-
10
+ #
9
11
  def pathize
10
- to_s.
11
- gsub(/::/, '/').
12
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
13
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
14
- tr("-", "_").
15
- downcase
12
+ name.pathize
13
+ #to_s.
14
+ # gsub(/::/, '/').
15
+ # gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
16
+ # gsub(/([a-z\d])([A-Z])/,'\1_\2').
17
+ # tr("-", "_").
18
+ # downcase
16
19
  end
17
20
 
18
21
  end
@@ -0,0 +1,35 @@
1
+ class Module
2
+
3
+ private
4
+
5
+ # Creates a new method for a pre-existing method.
6
+ #
7
+ # If _aka_ is given, then the method being redefined will
8
+ # first be aliased to this name.
9
+ #
10
+ # class Greeter
11
+ # def hello ; "Hello" ; end
12
+ # end
13
+ #
14
+ # Greeter.new.hello #=> "Hello"
15
+ #
16
+ # class Greeter
17
+ # redefine_method( :hello, :hi ) do
18
+ # hi + ", friend!"
19
+ # end
20
+ # end
21
+ #
22
+ # Greeter.new.hello #=> "Hello, friend!"
23
+ #
24
+ # CREDIT: Trans
25
+
26
+ def redefine_method(sym, aka=nil, &blk)
27
+ raise ArgumentError, "method does not exist" unless method_defined?( sym )
28
+ alias_method( aka, sym ) if aka
29
+ undef_method( sym )
30
+ define_method( sym, &blk )
31
+ end
32
+
33
+ alias_method :redef, :redefine_method
34
+
35
+ end
@@ -0,0 +1,45 @@
1
+ class Module
2
+
3
+ private
4
+
5
+ # Redirect methods to other methods. This simply
6
+ # defines methods by the name of a hash key which
7
+ # calls the method with the name of the hash's value.
8
+ #
9
+ # class Example
10
+ # redirect_method :hi => :hello, :hey => :hello
11
+ # def hello(name)
12
+ # puts "Hello, #{name}."
13
+ # end
14
+ # end
15
+ #
16
+ # e = Example.new
17
+ # e.hello("Bob") #=> "Hello, Bob."
18
+ # e.hi("Bob") #=> "Hello, Bob."
19
+ # e.hey("Bob") #=> "Hello, Bob."
20
+ #
21
+ # The above class definition is equivalent to:
22
+ #
23
+ # class Example
24
+ # def hi(*args)
25
+ # hello(*args)
26
+ # end
27
+ # def hey(*args)
28
+ # hello(*args)
29
+ # end
30
+ # def hello
31
+ # puts "Hello"
32
+ # end
33
+ # end
34
+ #
35
+ # CREDIT: Trans
36
+
37
+ def redirect_method( method_hash )
38
+ method_hash.each do |targ,adv|
39
+ define_method(targ) { |*args| send(adv,*args) }
40
+ end
41
+ end
42
+
43
+ alias_method :redirect, :redirect_method
44
+
45
+ end
@@ -0,0 +1,20 @@
1
+ class Module
2
+
3
+ private
4
+
5
+ # Aliases a method and undefines the original.
6
+ #
7
+ # rename_method( :to_method, :from_method )
8
+ #
9
+ # CREDIT: Trans
10
+
11
+ def rename_method( to_sym, from_sym )
12
+ raise ArgumentError, "method #{from_sym} does not exist" unless method_defined?( from_sym )
13
+ alias_method( to_sym, from_sym )
14
+ undef_method( from_sym )
15
+ end
16
+
17
+ alias_method :rename, :rename_method
18
+
19
+ end
20
+
@@ -1,3 +1,8 @@
1
+ require 'facets/module/redirect_method'
2
+ require 'facets/module/redefine_method'
3
+ require 'facets/module/rename_method'
4
+ require 'facets/module/wrap_method'
5
+
1
6
  class Module
2
7
 
3
8
  # Return a new module based on another.
@@ -50,119 +55,8 @@ class Module
50
55
  include m
51
56
  end
52
57
 
53
- private
54
-
55
- # Creates a new method for a pre-existing method.
56
- #
57
- # If _aka_ is given, then the method being redefined will
58
- # first be aliased to this name.
59
- #
60
- # class Greeter
61
- # def hello ; "Hello" ; end
62
- # end
63
- #
64
- # Greeter.new.hello #=> "Hello"
65
- #
66
- # class Greeter
67
- # redefine_method( :hello, :hi ) do
68
- # hi + ", friend!"
69
- # end
70
- # end
71
- #
72
- # Greeter.new.hello #=> "Hello, friend!"
73
- #
74
- # CREDIT: Trans
75
-
76
- def redefine_method(sym, aka=nil, &blk)
77
- raise ArgumentError, "method does not exist" unless method_defined?( sym )
78
- alias_method( aka, sym ) if aka
79
- undef_method( sym )
80
- define_method( sym, &blk )
81
- end
82
-
83
- # Redirect methods to other methods. This simply
84
- # defines methods by the name of a hash key which
85
- # calls the method with the name of the hash's value.
86
- #
87
- # class Example
88
- # redirect_method :hi => :hello, :hey => :hello
89
- # def hello(name)
90
- # puts "Hello, #{name}."
91
- # end
92
- # end
93
- #
94
- # e = Example.new
95
- # e.hello("Bob") #=> "Hello, Bob."
96
- # e.hi("Bob") #=> "Hello, Bob."
97
- # e.hey("Bob") #=> "Hello, Bob."
98
- #
99
- # The above class definition is equivalent to:
100
- #
101
- # class Example
102
- # def hi(*args)
103
- # hello(*args)
104
- # end
105
- # def hey(*args)
106
- # hello(*args)
107
- # end
108
- # def hello
109
- # puts "Hello"
110
- # end
111
- # end
112
- #
113
- # CREDIT: Trans
114
-
115
- def redirect_method( method_hash )
116
- method_hash.each do |targ,adv|
117
- define_method(targ) { |*args| send(adv,*args) }
118
- end
119
- end
120
-
121
- # Aliases a method and undefines the original.
122
- #
123
- # rename_method( :to_method, :from_method )
124
- #
125
- # CREDIT: Trans
126
-
127
- def rename_method( to_sym, from_sym )
128
- raise ArgumentError, "method #{from_sym} does not exist" unless method_defined?( from_sym )
129
- alias_method( to_sym, from_sym )
130
- undef_method( from_sym )
131
- end
132
-
133
- # TODO: Are these aliases really desitrable?
134
-
135
- alias_method :remove, :remove_method
136
- alias_method :nodef, :undef_method
137
- alias_method :redef, :redefine_method
138
- alias_method :redirect, :redirect_method
139
- alias_method :rename, :rename_method
140
-
141
- # Don't think we should bother making this private.
142
- # That sort of defeats some of the AOP usefulness of this.
143
- public
144
-
145
- # Creates a new method wrapping the previous of
146
- # the same name. Reference to the old method
147
- # is passed into the new definition block
148
- # as the first parameter.
149
- #
150
- # wrap_method( sym ) { |old_meth, *args|
151
- # old_meth.call
152
- # ...
153
- # }
154
- #
155
- # Keep in mind that this can not be used to wrap methods
156
- # that take a block.
157
- #
158
- # CREDIT: Trans
159
-
160
- def wrap_method( sym, &blk )
161
- old = instance_method(sym)
162
- define_method(sym) { |*args| blk.call(old.bind(self), *args) }
163
- end
164
-
165
- alias_method :wrap, :wrap_method
58
+ alias_method :remove, :remove_method
59
+ alias_method :nodef, :undef_method
166
60
 
167
61
  end
168
62
 
@@ -0,0 +1,28 @@
1
+ class Module
2
+
3
+ #private # (we'll leave this one public for AOP-like uses).
4
+
5
+ # Creates a new method wrapping the previous of
6
+ # the same name. Reference to the old method
7
+ # is passed into the new definition block
8
+ # as the first parameter.
9
+ #
10
+ # wrap_method( sym ) { |old_meth, *args|
11
+ # old_meth.call
12
+ # ...
13
+ # }
14
+ #
15
+ # Keep in mind that this can not be used to wrap methods
16
+ # that take a block.
17
+ #
18
+ # CREDIT: Trans
19
+
20
+ def wrap_method( sym, &blk )
21
+ old = instance_method(sym)
22
+ define_method(sym) { |*args| blk.call(old.bind(self), *args) }
23
+ end
24
+
25
+ alias_method :wrap, :wrap_method
26
+
27
+ end
28
+