facets 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (677) hide show
  1. data/HISTORY.rdoc +2245 -0
  2. data/MANIFEST +20 -725
  3. data/{README → README.rdoc} +0 -0
  4. data/RELEASE +37 -48
  5. data/doc/log/stats/index.html +39 -0
  6. data/doc/notes/CHANGES +2529 -0
  7. data/lib/{more → core}/facets/binding/opvars.rb +0 -0
  8. data/lib/core/facets/integer/length.rb +16 -0
  9. data/lib/core/facets/kernel/state.rb +50 -0
  10. data/lib/core/facets/module/extend.rb +2 -2
  11. data/lib/core/facets/string/camelcase.rb +33 -9
  12. data/lib/core/facets/string/lowercase.rb +1 -0
  13. data/lib/core/facets/string/methodize.rb +10 -1
  14. data/lib/core/facets/string/modulize.rb +8 -0
  15. data/lib/core/facets/string/pathize.rb +10 -0
  16. data/lib/core/facets/string/snakecase.rb +2 -2
  17. data/lib/core/facets/string/underscore.rb +21 -0
  18. data/lib/core/facets/string/uppercase.rb +23 -0
  19. data/lib/more/facets/censor.rb +97 -0
  20. data/lib/more/facets/minitar.rb +11 -11
  21. data/lib/more/facets/platform.rb +47 -0
  22. data/lib/more/facets/pry.rb +32 -0
  23. data/lib/more/facets/string/obfuscate.rb +65 -0
  24. data/lib/more/facets/string/stylize.rb +169 -0
  25. data/lib/more/facets/string/words.rb +10 -13
  26. data/meta/modified +1 -0
  27. data/meta/package +1 -0
  28. data/meta/version +1 -0
  29. data/test/core/integer/test_length.rb +12 -0
  30. metadata +41 -822
  31. data/CHANGES +0 -133
  32. data/VERSION +0 -1
  33. data/doc/changelogs/CHANGELOG-0.10.30 +0 -239
  34. data/doc/changelogs/CHANGELOG-1.8.54 +0 -450
  35. data/doc/changelogs/CHANGELOG-2.4.5 +0 -1654
  36. data/doc/rdoc/core/classes/Array.html +0 -1208
  37. data/doc/rdoc/core/classes/Binding.html +0 -364
  38. data/doc/rdoc/core/classes/Class.html +0 -444
  39. data/doc/rdoc/core/classes/Comparable.html +0 -250
  40. data/doc/rdoc/core/classes/Dir.html +0 -395
  41. data/doc/rdoc/core/classes/Enumerable.html +0 -1262
  42. data/doc/rdoc/core/classes/Enumerable/Enumerator.html +0 -243
  43. data/doc/rdoc/core/classes/Enumerator.html +0 -242
  44. data/doc/rdoc/core/classes/Exception.html +0 -163
  45. data/doc/rdoc/core/classes/FalseClass.html +0 -131
  46. data/doc/rdoc/core/classes/File.html +0 -576
  47. data/doc/rdoc/core/classes/FileTest.html +0 -116
  48. data/doc/rdoc/core/classes/Float.html +0 -159
  49. data/doc/rdoc/core/classes/Functor.html +0 -171
  50. data/doc/rdoc/core/classes/Hash.html +0 -2184
  51. data/doc/rdoc/core/classes/Indexable.html +0 -629
  52. data/doc/rdoc/core/classes/InstanceVariables.html +0 -306
  53. data/doc/rdoc/core/classes/Integer.html +0 -583
  54. data/doc/rdoc/core/classes/Kernel.html +0 -2269
  55. data/doc/rdoc/core/classes/Lazy.html +0 -96
  56. data/doc/rdoc/core/classes/Lazy/Future.html +0 -100
  57. data/doc/rdoc/core/classes/Lazy/Promise.html +0 -114
  58. data/doc/rdoc/core/classes/Lazy/PromiseSafe.html +0 -99
  59. data/doc/rdoc/core/classes/MatchData.html +0 -204
  60. data/doc/rdoc/core/classes/Module.html +0 -1316
  61. data/doc/rdoc/core/classes/NilClass.html +0 -217
  62. data/doc/rdoc/core/classes/Numeric.html +0 -251
  63. data/doc/rdoc/core/classes/Object.html +0 -161
  64. data/doc/rdoc/core/classes/ObjectSpace.html +0 -114
  65. data/doc/rdoc/core/classes/Proc.html +0 -302
  66. data/doc/rdoc/core/classes/Range.html +0 -360
  67. data/doc/rdoc/core/classes/Regexp.html +0 -191
  68. data/doc/rdoc/core/classes/Stackable.html +0 -262
  69. data/doc/rdoc/core/classes/String.html +0 -2332
  70. data/doc/rdoc/core/classes/Struct.html +0 -121
  71. data/doc/rdoc/core/classes/Symbol.html +0 -441
  72. data/doc/rdoc/core/classes/Time.html +0 -521
  73. data/doc/rdoc/core/classes/TrueClass.html +0 -131
  74. data/doc/rdoc/core/classes/UnboundMethod.html +0 -200
  75. data/doc/rdoc/core/created.rid +0 -1
  76. data/doc/rdoc/core/files/README.html +0 -287
  77. data/doc/rdoc/core/files/doc/README_core.html +0 -230
  78. data/doc/rdoc/core/files/lib/core/facets/array/combination_rb.html +0 -96
  79. data/doc/rdoc/core/files/lib/core/facets/array/conjoin_rb.html +0 -92
  80. data/doc/rdoc/core/files/lib/core/facets/array/delete_rb.html +0 -101
  81. data/doc/rdoc/core/files/lib/core/facets/array/delete_unless_rb.html +0 -92
  82. data/doc/rdoc/core/files/lib/core/facets/array/delete_values_rb.html +0 -92
  83. data/doc/rdoc/core/files/lib/core/facets/array/index_rb.html +0 -92
  84. data/doc/rdoc/core/files/lib/core/facets/array/indexable_rb.html +0 -97
  85. data/doc/rdoc/core/files/lib/core/facets/array/merge_rb.html +0 -92
  86. data/doc/rdoc/core/files/lib/core/facets/array/not_empty_rb.html +0 -92
  87. data/doc/rdoc/core/files/lib/core/facets/array/only_rb.html +0 -92
  88. data/doc/rdoc/core/files/lib/core/facets/array/pad_rb.html +0 -92
  89. data/doc/rdoc/core/files/lib/core/facets/array/permutation_rb.html +0 -92
  90. data/doc/rdoc/core/files/lib/core/facets/array/product_rb.html +0 -92
  91. data/doc/rdoc/core/files/lib/core/facets/array/recursively_rb.html +0 -92
  92. data/doc/rdoc/core/files/lib/core/facets/array/rotate_rb.html +0 -92
  93. data/doc/rdoc/core/files/lib/core/facets/array/select_rb.html +0 -92
  94. data/doc/rdoc/core/files/lib/core/facets/array/splice_rb.html +0 -92
  95. data/doc/rdoc/core/files/lib/core/facets/array/stackable_rb.html +0 -97
  96. data/doc/rdoc/core/files/lib/core/facets/array/traverse_rb.html +0 -92
  97. data/doc/rdoc/core/files/lib/core/facets/array_rb.html +0 -92
  98. data/doc/rdoc/core/files/lib/core/facets/binding/caller_rb.html +0 -97
  99. data/doc/rdoc/core/files/lib/core/facets/binding/callstack_rb.html +0 -96
  100. data/doc/rdoc/core/files/lib/core/facets/binding/defined_rb.html +0 -96
  101. data/doc/rdoc/core/files/lib/core/facets/binding/eval_rb.html +0 -92
  102. data/doc/rdoc/core/files/lib/core/facets/binding/local_variables_rb.html +0 -96
  103. data/doc/rdoc/core/files/lib/core/facets/binding/self_rb.html +0 -96
  104. data/doc/rdoc/core/files/lib/core/facets/binding_rb.html +0 -92
  105. data/doc/rdoc/core/files/lib/core/facets/bitmask_rb.html +0 -92
  106. data/doc/rdoc/core/files/lib/core/facets/blank_rb.html +0 -97
  107. data/doc/rdoc/core/files/lib/core/facets/boolean_rb.html +0 -126
  108. data/doc/rdoc/core/files/lib/core/facets/cattr_rb.html +0 -100
  109. data/doc/rdoc/core/files/lib/core/facets/class/cattr_accessor_rb.html +0 -96
  110. data/doc/rdoc/core/files/lib/core/facets/class/cattr_rb.html +0 -92
  111. data/doc/rdoc/core/files/lib/core/facets/class/cattr_reader_rb.html +0 -96
  112. data/doc/rdoc/core/files/lib/core/facets/class/cattr_writer_rb.html +0 -96
  113. data/doc/rdoc/core/files/lib/core/facets/class/descendents_rb.html +0 -92
  114. data/doc/rdoc/core/files/lib/core/facets/class/methodize_rb.html +0 -96
  115. data/doc/rdoc/core/files/lib/core/facets/class/pathize_rb.html +0 -96
  116. data/doc/rdoc/core/files/lib/core/facets/class/prepend_rb.html +0 -92
  117. data/doc/rdoc/core/files/lib/core/facets/class/subclasses_rb.html +0 -96
  118. data/doc/rdoc/core/files/lib/core/facets/class/to_proc_rb.html +0 -92
  119. data/doc/rdoc/core/files/lib/core/facets/class_rb.html +0 -92
  120. data/doc/rdoc/core/files/lib/core/facets/comparable/at_least_rb.html +0 -96
  121. data/doc/rdoc/core/files/lib/core/facets/comparable/at_most_rb.html +0 -96
  122. data/doc/rdoc/core/files/lib/core/facets/comparable/bound_rb.html +0 -96
  123. data/doc/rdoc/core/files/lib/core/facets/comparable/cap_rb.html +0 -92
  124. data/doc/rdoc/core/files/lib/core/facets/comparable/clip_rb.html +0 -92
  125. data/doc/rdoc/core/files/lib/core/facets/comparable/cmp_rb.html +0 -92
  126. data/doc/rdoc/core/files/lib/core/facets/comparable/comparable_rb.html +0 -109
  127. data/doc/rdoc/core/files/lib/core/facets/comparable_rb.html +0 -92
  128. data/doc/rdoc/core/files/lib/core/facets/dir/ascend_rb.html +0 -92
  129. data/doc/rdoc/core/files/lib/core/facets/dir/descend_rb.html +0 -96
  130. data/doc/rdoc/core/files/lib/core/facets/dir/multiglob_rb.html +0 -92
  131. data/doc/rdoc/core/files/lib/core/facets/dir/parent_rb.html +0 -92
  132. data/doc/rdoc/core/files/lib/core/facets/dir/recurse_rb.html +0 -92
  133. data/doc/rdoc/core/files/lib/core/facets/dir_rb.html +0 -92
  134. data/doc/rdoc/core/files/lib/core/facets/enumerable/accumulate_rb.html +0 -96
  135. data/doc/rdoc/core/files/lib/core/facets/enumerable/cluster_by_rb.html +0 -96
  136. data/doc/rdoc/core/files/lib/core/facets/enumerable/collect_rb.html +0 -101
  137. data/doc/rdoc/core/files/lib/core/facets/enumerable/commonality_rb.html +0 -92
  138. data/doc/rdoc/core/files/lib/core/facets/enumerable/compact_map_rb.html +0 -92
  139. data/doc/rdoc/core/files/lib/core/facets/enumerable/count_rb.html +0 -92
  140. data/doc/rdoc/core/files/lib/core/facets/enumerable/divide_rb.html +0 -92
  141. data/doc/rdoc/core/files/lib/core/facets/enumerable/duplicates_rb.html +0 -92
  142. data/doc/rdoc/core/files/lib/core/facets/enumerable/each_by_rb.html +0 -96
  143. data/doc/rdoc/core/files/lib/core/facets/enumerable/entropy_rb.html +0 -96
  144. data/doc/rdoc/core/files/lib/core/facets/enumerable/frequency_rb.html +0 -92
  145. data/doc/rdoc/core/files/lib/core/facets/enumerable/graph_rb.html +0 -96
  146. data/doc/rdoc/core/files/lib/core/facets/enumerable/group_by_rb.html +0 -92
  147. data/doc/rdoc/core/files/lib/core/facets/enumerable/inject_rb.html +0 -92
  148. data/doc/rdoc/core/files/lib/core/facets/enumerable/map_send_rb.html +0 -92
  149. data/doc/rdoc/core/files/lib/core/facets/enumerable/map_with_index_rb.html +0 -92
  150. data/doc/rdoc/core/files/lib/core/facets/enumerable/mash_rb.html +0 -92
  151. data/doc/rdoc/core/files/lib/core/facets/enumerable/mode_rb.html +0 -92
  152. data/doc/rdoc/core/files/lib/core/facets/enumerable/modulate_rb.html +0 -92
  153. data/doc/rdoc/core/files/lib/core/facets/enumerable/none_rb.html +0 -92
  154. data/doc/rdoc/core/files/lib/core/facets/enumerable/occur_rb.html +0 -92
  155. data/doc/rdoc/core/files/lib/core/facets/enumerable/one_rb.html +0 -92
  156. data/doc/rdoc/core/files/lib/core/facets/enumerable/probability_rb.html +0 -92
  157. data/doc/rdoc/core/files/lib/core/facets/enumerable/split_rb.html +0 -92
  158. data/doc/rdoc/core/files/lib/core/facets/enumerable/sum_rb.html +0 -92
  159. data/doc/rdoc/core/files/lib/core/facets/enumerable/take_rb.html +0 -92
  160. data/doc/rdoc/core/files/lib/core/facets/enumerable/uniq_by_rb.html +0 -92
  161. data/doc/rdoc/core/files/lib/core/facets/enumerable_rb.html +0 -92
  162. data/doc/rdoc/core/files/lib/core/facets/exception/detail_rb.html +0 -92
  163. data/doc/rdoc/core/files/lib/core/facets/exception/suppress_rb.html +0 -92
  164. data/doc/rdoc/core/files/lib/core/facets/exception_rb.html +0 -92
  165. data/doc/rdoc/core/files/lib/core/facets/file/append_rb.html +0 -92
  166. data/doc/rdoc/core/files/lib/core/facets/file/create_rb.html +0 -92
  167. data/doc/rdoc/core/files/lib/core/facets/file/null_rb.html +0 -92
  168. data/doc/rdoc/core/files/lib/core/facets/file/read_rb.html +0 -92
  169. data/doc/rdoc/core/files/lib/core/facets/file/rewrite_rb.html +0 -92
  170. data/doc/rdoc/core/files/lib/core/facets/file/rootname_rb.html +0 -92
  171. data/doc/rdoc/core/files/lib/core/facets/file/split_all_rb.html +0 -92
  172. data/doc/rdoc/core/files/lib/core/facets/file/split_root_rb.html +0 -92
  173. data/doc/rdoc/core/files/lib/core/facets/file/write_rb.html +0 -102
  174. data/doc/rdoc/core/files/lib/core/facets/file/writelines_rb.html +0 -92
  175. data/doc/rdoc/core/files/lib/core/facets/file_rb.html +0 -92
  176. data/doc/rdoc/core/files/lib/core/facets/filetest/root_rb.html +0 -92
  177. data/doc/rdoc/core/files/lib/core/facets/filetest_rb.html +0 -92
  178. data/doc/rdoc/core/files/lib/core/facets/float/round_rb.html +0 -96
  179. data/doc/rdoc/core/files/lib/core/facets/float_rb.html +0 -92
  180. data/doc/rdoc/core/files/lib/core/facets/functor_rb.html +0 -151
  181. data/doc/rdoc/core/files/lib/core/facets/hash/alias_rb.html +0 -92
  182. data/doc/rdoc/core/files/lib/core/facets/hash/argumentize_rb.html +0 -92
  183. data/doc/rdoc/core/files/lib/core/facets/hash/at_rb.html +0 -92
  184. data/doc/rdoc/core/files/lib/core/facets/hash/autonew_rb.html +0 -92
  185. data/doc/rdoc/core/files/lib/core/facets/hash/collate_rb.html +0 -92
  186. data/doc/rdoc/core/files/lib/core/facets/hash/dearray_values_rb.html +0 -92
  187. data/doc/rdoc/core/files/lib/core/facets/hash/delete_rb.html +0 -92
  188. data/doc/rdoc/core/files/lib/core/facets/hash/diff_rb.html +0 -92
  189. data/doc/rdoc/core/files/lib/core/facets/hash/except_rb.html +0 -92
  190. data/doc/rdoc/core/files/lib/core/facets/hash/group_by_value_rb.html +0 -92
  191. data/doc/rdoc/core/files/lib/core/facets/hash/insert_rb.html +0 -92
  192. data/doc/rdoc/core/files/lib/core/facets/hash/inverse_rb.html +0 -92
  193. data/doc/rdoc/core/files/lib/core/facets/hash/join_rb.html +0 -92
  194. data/doc/rdoc/core/files/lib/core/facets/hash/keys_rb.html +0 -92
  195. data/doc/rdoc/core/files/lib/core/facets/hash/mash_rb.html +0 -96
  196. data/doc/rdoc/core/files/lib/core/facets/hash/merge_rb.html +0 -92
  197. data/doc/rdoc/core/files/lib/core/facets/hash/new_with_rb.html +0 -92
  198. data/doc/rdoc/core/files/lib/core/facets/hash/op_add_rb.html +0 -92
  199. data/doc/rdoc/core/files/lib/core/facets/hash/op_and_rb.html +0 -92
  200. data/doc/rdoc/core/files/lib/core/facets/hash/op_mul_rb.html +0 -92
  201. data/doc/rdoc/core/files/lib/core/facets/hash/op_or_rb.html +0 -92
  202. data/doc/rdoc/core/files/lib/core/facets/hash/op_push_rb.html +0 -92
  203. data/doc/rdoc/core/files/lib/core/facets/hash/op_rb.html +0 -101
  204. data/doc/rdoc/core/files/lib/core/facets/hash/op_sub_rb.html +0 -92
  205. data/doc/rdoc/core/files/lib/core/facets/hash/recursive_merge_rb.html +0 -92
  206. data/doc/rdoc/core/files/lib/core/facets/hash/recursively_rb.html +0 -92
  207. data/doc/rdoc/core/files/lib/core/facets/hash/rekey_rb.html +0 -96
  208. data/doc/rdoc/core/files/lib/core/facets/hash/replace_each_rb.html +0 -92
  209. data/doc/rdoc/core/files/lib/core/facets/hash/select_rb.html +0 -92
  210. data/doc/rdoc/core/files/lib/core/facets/hash/slice_rb.html +0 -96
  211. data/doc/rdoc/core/files/lib/core/facets/hash/stringify_keys_rb.html +0 -96
  212. data/doc/rdoc/core/files/lib/core/facets/hash/swap_rb.html +0 -92
  213. data/doc/rdoc/core/files/lib/core/facets/hash/symbolize_keys_rb.html +0 -96
  214. data/doc/rdoc/core/files/lib/core/facets/hash/to_h_rb.html +0 -96
  215. data/doc/rdoc/core/files/lib/core/facets/hash/to_options_rb.html +0 -96
  216. data/doc/rdoc/core/files/lib/core/facets/hash/to_proc_rb.html +0 -92
  217. data/doc/rdoc/core/files/lib/core/facets/hash/to_struct_rb.html +0 -92
  218. data/doc/rdoc/core/files/lib/core/facets/hash/traverse_rb.html +0 -92
  219. data/doc/rdoc/core/files/lib/core/facets/hash/update_each_rb.html +0 -92
  220. data/doc/rdoc/core/files/lib/core/facets/hash/update_keys_rb.html +0 -92
  221. data/doc/rdoc/core/files/lib/core/facets/hash/update_rb.html +0 -103
  222. data/doc/rdoc/core/files/lib/core/facets/hash/update_values_rb.html +0 -92
  223. data/doc/rdoc/core/files/lib/core/facets/hash/weave_rb.html +0 -92
  224. data/doc/rdoc/core/files/lib/core/facets/hash/zipnew_rb.html +0 -92
  225. data/doc/rdoc/core/files/lib/core/facets/hash_rb.html +0 -92
  226. data/doc/rdoc/core/files/lib/core/facets/indexable_rb.html +0 -113
  227. data/doc/rdoc/core/files/lib/core/facets/integer/even_rb.html +0 -96
  228. data/doc/rdoc/core/files/lib/core/facets/integer/factorial_rb.html +0 -92
  229. data/doc/rdoc/core/files/lib/core/facets/integer/multiple_rb.html +0 -92
  230. data/doc/rdoc/core/files/lib/core/facets/integer/odd_rb.html +0 -92
  231. data/doc/rdoc/core/files/lib/core/facets/integer/of_rb.html +0 -92
  232. data/doc/rdoc/core/files/lib/core/facets/integer/ordinal_rb.html +0 -92
  233. data/doc/rdoc/core/files/lib/core/facets/integer_rb.html +0 -92
  234. data/doc/rdoc/core/files/lib/core/facets/kernel/__callee___rb.html +0 -96
  235. data/doc/rdoc/core/files/lib/core/facets/kernel/__class___rb.html +0 -92
  236. data/doc/rdoc/core/files/lib/core/facets/kernel/__dir___rb.html +0 -92
  237. data/doc/rdoc/core/files/lib/core/facets/kernel/__get___rb.html +0 -92
  238. data/doc/rdoc/core/files/lib/core/facets/kernel/__here___rb.html +0 -92
  239. data/doc/rdoc/core/files/lib/core/facets/kernel/__method___rb.html +0 -92
  240. data/doc/rdoc/core/files/lib/core/facets/kernel/__set___rb.html +0 -96
  241. data/doc/rdoc/core/files/lib/core/facets/kernel/as_rb.html +0 -96
  242. data/doc/rdoc/core/files/lib/core/facets/kernel/ask_rb.html +0 -92
  243. data/doc/rdoc/core/files/lib/core/facets/kernel/attr_singleton_rb.html +0 -92
  244. data/doc/rdoc/core/files/lib/core/facets/kernel/callstack_rb.html +0 -92
  245. data/doc/rdoc/core/files/lib/core/facets/kernel/complete_rb.html +0 -92
  246. data/doc/rdoc/core/files/lib/core/facets/kernel/constant_rb.html +0 -92
  247. data/doc/rdoc/core/files/lib/core/facets/kernel/d_rb.html +0 -92
  248. data/doc/rdoc/core/files/lib/core/facets/kernel/deep_copy_rb.html +0 -92
  249. data/doc/rdoc/core/files/lib/core/facets/kernel/demo_rb.html +0 -92
  250. data/doc/rdoc/core/files/lib/core/facets/kernel/ergo_rb.html +0 -96
  251. data/doc/rdoc/core/files/lib/core/facets/kernel/here_rb.html +0 -92
  252. data/doc/rdoc/core/files/lib/core/facets/kernel/in_rb.html +0 -92
  253. data/doc/rdoc/core/files/lib/core/facets/kernel/instance_assign_rb.html +0 -92
  254. data/doc/rdoc/core/files/lib/core/facets/kernel/instance_class_rb.html +0 -92
  255. data/doc/rdoc/core/files/lib/core/facets/kernel/instance_exec_rb.html +0 -92
  256. data/doc/rdoc/core/files/lib/core/facets/kernel/instance_rb.html +0 -96
  257. data/doc/rdoc/core/files/lib/core/facets/kernel/instance_send_rb.html +0 -92
  258. data/doc/rdoc/core/files/lib/core/facets/kernel/instance_variables_rb.html +0 -92
  259. data/doc/rdoc/core/files/lib/core/facets/kernel/maybe_rb.html +0 -92
  260. data/doc/rdoc/core/files/lib/core/facets/kernel/not_nil_rb.html +0 -92
  261. data/doc/rdoc/core/files/lib/core/facets/kernel/object_class_rb.html +0 -92
  262. data/doc/rdoc/core/files/lib/core/facets/kernel/object_hexid_rb.html +0 -92
  263. data/doc/rdoc/core/files/lib/core/facets/kernel/object_send_rb.html +0 -92
  264. data/doc/rdoc/core/files/lib/core/facets/kernel/p_rb.html +0 -92
  265. data/doc/rdoc/core/files/lib/core/facets/kernel/populate_rb.html +0 -92
  266. data/doc/rdoc/core/files/lib/core/facets/kernel/qua_class_rb.html +0 -92
  267. data/doc/rdoc/core/files/lib/core/facets/kernel/require_all_rb.html +0 -92
  268. data/doc/rdoc/core/files/lib/core/facets/kernel/require_local_rb.html +0 -92
  269. data/doc/rdoc/core/files/lib/core/facets/kernel/resc_rb.html +0 -92
  270. data/doc/rdoc/core/files/lib/core/facets/kernel/respond_rb.html +0 -92
  271. data/doc/rdoc/core/files/lib/core/facets/kernel/returning_rb.html +0 -92
  272. data/doc/rdoc/core/files/lib/core/facets/kernel/silence_rb.html +0 -92
  273. data/doc/rdoc/core/files/lib/core/facets/kernel/singleton_class_rb.html +0 -92
  274. data/doc/rdoc/core/files/lib/core/facets/kernel/tap_rb.html +0 -92
  275. data/doc/rdoc/core/files/lib/core/facets/kernel/try_rb.html +0 -92
  276. data/doc/rdoc/core/files/lib/core/facets/kernel/val_rb.html +0 -92
  277. data/doc/rdoc/core/files/lib/core/facets/kernel/with_rb.html +0 -92
  278. data/doc/rdoc/core/files/lib/core/facets/kernel_rb.html +0 -92
  279. data/doc/rdoc/core/files/lib/core/facets/lazy_rb.html +0 -120
  280. data/doc/rdoc/core/files/lib/core/facets/matchdata/match_rb.html +0 -92
  281. data/doc/rdoc/core/files/lib/core/facets/matchdata/matchset_rb.html +0 -92
  282. data/doc/rdoc/core/files/lib/core/facets/matchdata_rb.html +0 -92
  283. data/doc/rdoc/core/files/lib/core/facets/metaid_rb.html +0 -92
  284. data/doc/rdoc/core/files/lib/core/facets/module/abstract_rb.html +0 -92
  285. data/doc/rdoc/core/files/lib/core/facets/module/alias_accessor_rb.html +0 -92
  286. data/doc/rdoc/core/files/lib/core/facets/module/alias_method_chain_rb.html +0 -92
  287. data/doc/rdoc/core/files/lib/core/facets/module/alias_module_function_rb.html +0 -92
  288. data/doc/rdoc/core/files/lib/core/facets/module/ancestor_rb.html +0 -92
  289. data/doc/rdoc/core/files/lib/core/facets/module/basename_rb.html +0 -92
  290. data/doc/rdoc/core/files/lib/core/facets/module/can_rb.html +0 -92
  291. data/doc/rdoc/core/files/lib/core/facets/module/class_rb.html +0 -92
  292. data/doc/rdoc/core/files/lib/core/facets/module/conflict_rb.html +0 -92
  293. data/doc/rdoc/core/files/lib/core/facets/module/extend_rb.html +0 -92
  294. data/doc/rdoc/core/files/lib/core/facets/module/include_function_module_rb.html +0 -92
  295. data/doc/rdoc/core/files/lib/core/facets/module/instance_methods_rb.html +0 -92
  296. data/doc/rdoc/core/files/lib/core/facets/module/integrate_rb.html +0 -96
  297. data/doc/rdoc/core/files/lib/core/facets/module/is_rb.html +0 -92
  298. data/doc/rdoc/core/files/lib/core/facets/module/methodize_rb.html +0 -96
  299. data/doc/rdoc/core/files/lib/core/facets/module/modspace_rb.html +0 -92
  300. data/doc/rdoc/core/files/lib/core/facets/module/module_load_rb.html +0 -92
  301. data/doc/rdoc/core/files/lib/core/facets/module/nesting_rb.html +0 -92
  302. data/doc/rdoc/core/files/lib/core/facets/module/op_rb.html +0 -92
  303. data/doc/rdoc/core/files/lib/core/facets/module/pathize_rb.html +0 -96
  304. data/doc/rdoc/core/files/lib/core/facets/module/prepend_rb.html +0 -92
  305. data/doc/rdoc/core/files/lib/core/facets/module/redefine_method_rb.html +0 -92
  306. data/doc/rdoc/core/files/lib/core/facets/module/redirect_method_rb.html +0 -92
  307. data/doc/rdoc/core/files/lib/core/facets/module/rename_method_rb.html +0 -92
  308. data/doc/rdoc/core/files/lib/core/facets/module/revise_rb.html +0 -99
  309. data/doc/rdoc/core/files/lib/core/facets/module/spacename_rb.html +0 -92
  310. data/doc/rdoc/core/files/lib/core/facets/module/wrap_method_rb.html +0 -92
  311. data/doc/rdoc/core/files/lib/core/facets/module_rb.html +0 -92
  312. data/doc/rdoc/core/files/lib/core/facets/nilclass/ergo_rb.html +0 -96
  313. data/doc/rdoc/core/files/lib/core/facets/nilclass/to_f_rb.html +0 -92
  314. data/doc/rdoc/core/files/lib/core/facets/nilclass_rb.html +0 -92
  315. data/doc/rdoc/core/files/lib/core/facets/numeric/approx_rb.html +0 -92
  316. data/doc/rdoc/core/files/lib/core/facets/numeric/distance_rb.html +0 -92
  317. data/doc/rdoc/core/files/lib/core/facets/numeric/round_rb.html +0 -92
  318. data/doc/rdoc/core/files/lib/core/facets/numeric_rb.html +0 -92
  319. data/doc/rdoc/core/files/lib/core/facets/objectspace/classes_rb.html +0 -92
  320. data/doc/rdoc/core/files/lib/core/facets/objectspace_rb.html +0 -92
  321. data/doc/rdoc/core/files/lib/core/facets/proc/bind_rb.html +0 -92
  322. data/doc/rdoc/core/files/lib/core/facets/proc/compose_rb.html +0 -92
  323. data/doc/rdoc/core/files/lib/core/facets/proc/curry_rb.html +0 -92
  324. data/doc/rdoc/core/files/lib/core/facets/proc/to_method_rb.html +0 -96
  325. data/doc/rdoc/core/files/lib/core/facets/proc/update_rb.html +0 -92
  326. data/doc/rdoc/core/files/lib/core/facets/proc_rb.html +0 -92
  327. data/doc/rdoc/core/files/lib/core/facets/range/combine_rb.html +0 -92
  328. data/doc/rdoc/core/files/lib/core/facets/range/overlap_rb.html +0 -92
  329. data/doc/rdoc/core/files/lib/core/facets/range/to_r_rb.html +0 -92
  330. data/doc/rdoc/core/files/lib/core/facets/range/umbrella_rb.html +0 -96
  331. data/doc/rdoc/core/files/lib/core/facets/range/within_rb.html +0 -92
  332. data/doc/rdoc/core/files/lib/core/facets/range_rb.html +0 -92
  333. data/doc/rdoc/core/files/lib/core/facets/regexp/arity_rb.html +0 -92
  334. data/doc/rdoc/core/files/lib/core/facets/regexp/to_re_rb.html +0 -92
  335. data/doc/rdoc/core/files/lib/core/facets/regexp_rb.html +0 -92
  336. data/doc/rdoc/core/files/lib/core/facets/stackable_rb.html +0 -120
  337. data/doc/rdoc/core/files/lib/core/facets/string/align_rb.html +0 -92
  338. data/doc/rdoc/core/files/lib/core/facets/string/bracket_rb.html +0 -92
  339. data/doc/rdoc/core/files/lib/core/facets/string/bytes_rb.html +0 -92
  340. data/doc/rdoc/core/files/lib/core/facets/string/camelcase_rb.html +0 -92
  341. data/doc/rdoc/core/files/lib/core/facets/string/capitalized_rb.html +0 -92
  342. data/doc/rdoc/core/files/lib/core/facets/string/chars_rb.html +0 -92
  343. data/doc/rdoc/core/files/lib/core/facets/string/chomp_rb.html +0 -92
  344. data/doc/rdoc/core/files/lib/core/facets/string/cleave_rb.html +0 -92
  345. data/doc/rdoc/core/files/lib/core/facets/string/compress_lines_rb.html +0 -92
  346. data/doc/rdoc/core/files/lib/core/facets/string/contains_rb.html +0 -92
  347. data/doc/rdoc/core/files/lib/core/facets/string/divide_rb.html +0 -92
  348. data/doc/rdoc/core/files/lib/core/facets/string/each_char_rb.html +0 -96
  349. data/doc/rdoc/core/files/lib/core/facets/string/each_word_rb.html +0 -96
  350. data/doc/rdoc/core/files/lib/core/facets/string/end_with_rb.html +0 -96
  351. data/doc/rdoc/core/files/lib/core/facets/string/expand_tab_rb.html +0 -92
  352. data/doc/rdoc/core/files/lib/core/facets/string/file_rb.html +0 -96
  353. data/doc/rdoc/core/files/lib/core/facets/string/fold_rb.html +0 -92
  354. data/doc/rdoc/core/files/lib/core/facets/string/indent_rb.html +0 -92
  355. data/doc/rdoc/core/files/lib/core/facets/string/interpolate_rb.html +0 -92
  356. data/doc/rdoc/core/files/lib/core/facets/string/line_wrap_rb.html +0 -92
  357. data/doc/rdoc/core/files/lib/core/facets/string/lines_rb.html +0 -92
  358. data/doc/rdoc/core/files/lib/core/facets/string/margin_rb.html +0 -92
  359. data/doc/rdoc/core/files/lib/core/facets/string/methodize_rb.html +0 -92
  360. data/doc/rdoc/core/files/lib/core/facets/string/modulize_rb.html +0 -92
  361. data/doc/rdoc/core/files/lib/core/facets/string/mscan_rb.html +0 -92
  362. data/doc/rdoc/core/files/lib/core/facets/string/natcmp_rb.html +0 -92
  363. data/doc/rdoc/core/files/lib/core/facets/string/nchar_rb.html +0 -92
  364. data/doc/rdoc/core/files/lib/core/facets/string/op_sub_rb.html +0 -92
  365. data/doc/rdoc/core/files/lib/core/facets/string/outdent_rb.html +0 -96
  366. data/doc/rdoc/core/files/lib/core/facets/string/pathize_rb.html +0 -92
  367. data/doc/rdoc/core/files/lib/core/facets/string/range_rb.html +0 -92
  368. data/doc/rdoc/core/files/lib/core/facets/string/rewrite_rb.html +0 -92
  369. data/doc/rdoc/core/files/lib/core/facets/string/shatter_rb.html +0 -92
  370. data/doc/rdoc/core/files/lib/core/facets/string/snakecase_rb.html +0 -92
  371. data/doc/rdoc/core/files/lib/core/facets/string/splice_rb.html +0 -92
  372. data/doc/rdoc/core/files/lib/core/facets/string/start_with_rb.html +0 -92
  373. data/doc/rdoc/core/files/lib/core/facets/string/subtract_rb.html +0 -100
  374. data/doc/rdoc/core/files/lib/core/facets/string/tab_rb.html +0 -99
  375. data/doc/rdoc/core/files/lib/core/facets/string/tabto_rb.html +0 -96
  376. data/doc/rdoc/core/files/lib/core/facets/string/titlecase_rb.html +0 -92
  377. data/doc/rdoc/core/files/lib/core/facets/string/to_re_rb.html +0 -92
  378. data/doc/rdoc/core/files/lib/core/facets/string/variablize_rb.html +0 -92
  379. data/doc/rdoc/core/files/lib/core/facets/string/word_wrap_rb.html +0 -92
  380. data/doc/rdoc/core/files/lib/core/facets/string/words_rb.html +0 -92
  381. data/doc/rdoc/core/files/lib/core/facets/string/xor_rb.html +0 -92
  382. data/doc/rdoc/core/files/lib/core/facets/string_rb.html +0 -92
  383. data/doc/rdoc/core/files/lib/core/facets/struct/attributes_rb.html +0 -92
  384. data/doc/rdoc/core/files/lib/core/facets/struct_rb.html +0 -92
  385. data/doc/rdoc/core/files/lib/core/facets/symbol/chomp_rb.html +0 -92
  386. data/doc/rdoc/core/files/lib/core/facets/symbol/generate_rb.html +0 -92
  387. data/doc/rdoc/core/files/lib/core/facets/symbol/not_rb.html +0 -92
  388. data/doc/rdoc/core/files/lib/core/facets/symbol/plain_rb.html +0 -92
  389. data/doc/rdoc/core/files/lib/core/facets/symbol/query_rb.html +0 -96
  390. data/doc/rdoc/core/files/lib/core/facets/symbol/re_s_rb.html +0 -96
  391. data/doc/rdoc/core/files/lib/core/facets/symbol/setter_rb.html +0 -96
  392. data/doc/rdoc/core/files/lib/core/facets/symbol/succ_rb.html +0 -92
  393. data/doc/rdoc/core/files/lib/core/facets/symbol/to_proc_rb.html +0 -92
  394. data/doc/rdoc/core/files/lib/core/facets/symbol/variablize_rb.html +0 -92
  395. data/doc/rdoc/core/files/lib/core/facets/symbol_rb.html +0 -92
  396. data/doc/rdoc/core/files/lib/core/facets/time/advance_rb.html +0 -92
  397. data/doc/rdoc/core/files/lib/core/facets/time/ago_rb.html +0 -96
  398. data/doc/rdoc/core/files/lib/core/facets/time/change_rb.html +0 -92
  399. data/doc/rdoc/core/files/lib/core/facets/time/elapse_rb.html +0 -92
  400. data/doc/rdoc/core/files/lib/core/facets/time/hence_rb.html +0 -96
  401. data/doc/rdoc/core/files/lib/core/facets/time/round_rb.html +0 -96
  402. data/doc/rdoc/core/files/lib/core/facets/time/set_rb.html +0 -92
  403. data/doc/rdoc/core/files/lib/core/facets/time/stamp_rb.html +0 -92
  404. data/doc/rdoc/core/files/lib/core/facets/time/to_time_rb.html +0 -92
  405. data/doc/rdoc/core/files/lib/core/facets/time/trunc_rb.html +0 -92
  406. data/doc/rdoc/core/files/lib/core/facets/time_rb.html +0 -92
  407. data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +0 -97
  408. data/doc/rdoc/core/files/lib/core/facets/unboundmethod/arguments_rb.html +0 -92
  409. data/doc/rdoc/core/files/lib/core/facets/unboundmethod/name_rb.html +0 -92
  410. data/doc/rdoc/core/files/lib/core/facets/unboundmethod_rb.html +0 -92
  411. data/doc/rdoc/core/fr_class_index.html +0 -85
  412. data/doc/rdoc/core/fr_file_index.html +0 -381
  413. data/doc/rdoc/core/fr_method_index.html +0 -520
  414. data/doc/rdoc/core/index.html +0 -26
  415. data/doc/rdoc/core/rdoc-style.css +0 -177
  416. data/doc/rdoc/more/classes/ANSICode.html +0 -493
  417. data/doc/rdoc/more/classes/Advisable.html +0 -269
  418. data/doc/rdoc/more/classes/Advisable/Method.html +0 -223
  419. data/doc/rdoc/more/classes/Archive.html +0 -89
  420. data/doc/rdoc/more/classes/Archive/Tar.html +0 -89
  421. data/doc/rdoc/more/classes/Archive/Tar/Minitar.html +0 -469
  422. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Input.html +0 -355
  423. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Output.html +0 -216
  424. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Reader.html +0 -283
  425. data/doc/rdoc/more/classes/Archive/Tar/Minitar/Writer.html +0 -378
  426. data/doc/rdoc/more/classes/Argvector.html +0 -487
  427. data/doc/rdoc/more/classes/Association.html +0 -319
  428. data/doc/rdoc/more/classes/Association/Kernel.html +0 -131
  429. data/doc/rdoc/more/classes/Autoarray.html +0 -166
  430. data/doc/rdoc/more/classes/BBCode.html +0 -532
  431. data/doc/rdoc/more/classes/BaseX.html +0 -194
  432. data/doc/rdoc/more/classes/BiCrypt.html +0 -541
  433. data/doc/rdoc/more/classes/BinReadable.html +0 -485
  434. data/doc/rdoc/more/classes/BinReadable/ByteOrder.html +0 -223
  435. data/doc/rdoc/more/classes/Binding.html +0 -146
  436. data/doc/rdoc/more/classes/BlankSlate.html +0 -129
  437. data/doc/rdoc/more/classes/Buildable.html +0 -152
  438. data/doc/rdoc/more/classes/BuildingBlock.html +0 -360
  439. data/doc/rdoc/more/classes/Capsule.html +0 -408
  440. data/doc/rdoc/more/classes/Capsule/MissingFile.html +0 -96
  441. data/doc/rdoc/more/classes/Cloneable.html +0 -129
  442. data/doc/rdoc/more/classes/ConsoleUtils.html +0 -238
  443. data/doc/rdoc/more/classes/Coroutine.html +0 -285
  444. data/doc/rdoc/more/classes/Crypt.html +0 -275
  445. data/doc/rdoc/more/classes/CssFilter.html +0 -471
  446. data/doc/rdoc/more/classes/CssTree.html +0 -149
  447. data/doc/rdoc/more/classes/Dictionary.html +0 -1255
  448. data/doc/rdoc/more/classes/Downloader.html +0 -512
  449. data/doc/rdoc/more/classes/Duration.html +0 -691
  450. data/doc/rdoc/more/classes/Duration/Numeric.html +0 -389
  451. data/doc/rdoc/more/classes/Duration/Time.html +0 -124
  452. data/doc/rdoc/more/classes/Enumerable.html +0 -401
  453. data/doc/rdoc/more/classes/Enumerable/Elementor.html +0 -170
  454. data/doc/rdoc/more/classes/Enumerable/Enumerator.html +0 -116
  455. data/doc/rdoc/more/classes/Enumerable/Filterable.html +0 -246
  456. data/doc/rdoc/more/classes/EnumerablePass.html +0 -214
  457. data/doc/rdoc/more/classes/Enumerator.html +0 -95
  458. data/doc/rdoc/more/classes/Enumerator/Filter.html +0 -104
  459. data/doc/rdoc/more/classes/Equatable.html +0 -188
  460. data/doc/rdoc/more/classes/Expirable.html +0 -195
  461. data/doc/rdoc/more/classes/FileList.html +0 -955
  462. data/doc/rdoc/more/classes/Fileable.html +0 -178
  463. data/doc/rdoc/more/classes/Fileable/DSL.html +0 -303
  464. data/doc/rdoc/more/classes/Hash.html +0 -171
  465. data/doc/rdoc/more/classes/Hash2Xml.html +0 -105
  466. data/doc/rdoc/more/classes/Hook.html +0 -162
  467. data/doc/rdoc/more/classes/HtmlFilter.html +0 -329
  468. data/doc/rdoc/more/classes/IORedirect.html +0 -220
  469. data/doc/rdoc/more/classes/InfinityClass.html +0 -448
  470. data/doc/rdoc/more/classes/InfinityClass/Numeric.html +0 -195
  471. data/doc/rdoc/more/classes/Ini.html +0 -447
  472. data/doc/rdoc/more/classes/Instantiable.html +0 -140
  473. data/doc/rdoc/more/classes/Instantize.html +0 -160
  474. data/doc/rdoc/more/classes/Interval.html +0 -877
  475. data/doc/rdoc/more/classes/It.html +0 -185
  476. data/doc/rdoc/more/classes/LRUCache.html +0 -321
  477. data/doc/rdoc/more/classes/LRUCache/Item.html +0 -114
  478. data/doc/rdoc/more/classes/LRUCache/Sentinel.html +0 -100
  479. data/doc/rdoc/more/classes/LinkedList.html +0 -432
  480. data/doc/rdoc/more/classes/LinkedList/Node.html +0 -149
  481. data/doc/rdoc/more/classes/Matcher.html +0 -335
  482. data/doc/rdoc/more/classes/Matcher/MatchData.html +0 -115
  483. data/doc/rdoc/more/classes/Memoizer.html +0 -240
  484. data/doc/rdoc/more/classes/MissingArgument.html +0 -97
  485. data/doc/rdoc/more/classes/Module.html +0 -1224
  486. data/doc/rdoc/more/classes/Multiton.html +0 -205
  487. data/doc/rdoc/more/classes/Multiton/Inclusive.html +0 -93
  488. data/doc/rdoc/more/classes/Multiton/MetaMethods.html +0 -221
  489. data/doc/rdoc/more/classes/NackClass.html +0 -98
  490. data/doc/rdoc/more/classes/Net.html +0 -88
  491. data/doc/rdoc/more/classes/Net/SMTP.html +0 -140
  492. data/doc/rdoc/more/classes/NullClass.html +0 -202
  493. data/doc/rdoc/more/classes/Numeric/Multipliers.html +0 -456
  494. data/doc/rdoc/more/classes/ObjectReflection.html +0 -172
  495. data/doc/rdoc/more/classes/OpEsc.html +0 -137
  496. data/doc/rdoc/more/classes/OpenCascade.html +0 -179
  497. data/doc/rdoc/more/classes/OpenCollection.html +0 -138
  498. data/doc/rdoc/more/classes/OpenHash.html +0 -157
  499. data/doc/rdoc/more/classes/OpenModule.html +0 -135
  500. data/doc/rdoc/more/classes/OpenObject.html +0 -608
  501. data/doc/rdoc/more/classes/OpenStructable.html +0 -326
  502. data/doc/rdoc/more/classes/PQueue.html +0 -607
  503. data/doc/rdoc/more/classes/Paramix.html +0 -201
  504. data/doc/rdoc/more/classes/Paramix/Delegator.html +0 -215
  505. data/doc/rdoc/more/classes/PathList.html +0 -159
  506. data/doc/rdoc/more/classes/PathList/Finder.html +0 -135
  507. data/doc/rdoc/more/classes/Platform.html +0 -444
  508. data/doc/rdoc/more/classes/Pool.html +0 -204
  509. data/doc/rdoc/more/classes/Proc.html +0 -180
  510. data/doc/rdoc/more/classes/ProgressBar.html +0 -356
  511. data/doc/rdoc/more/classes/Prototype.html +0 -243
  512. data/doc/rdoc/more/classes/RWDelegator.html +0 -194
  513. data/doc/rdoc/more/classes/Random.html +0 -145
  514. data/doc/rdoc/more/classes/Random/Array.html +0 -339
  515. data/doc/rdoc/more/classes/Random/Hash.html +0 -378
  516. data/doc/rdoc/more/classes/Random/Object.html +0 -119
  517. data/doc/rdoc/more/classes/Random/String.html +0 -299
  518. data/doc/rdoc/more/classes/Random/String/Self.html +0 -153
  519. data/doc/rdoc/more/classes/Recorder.html +0 -203
  520. data/doc/rdoc/more/classes/Reference.html +0 -196
  521. data/doc/rdoc/more/classes/Registerable.html +0 -157
  522. data/doc/rdoc/more/classes/Semaphore.html +0 -260
  523. data/doc/rdoc/more/classes/Settings.html +0 -288
  524. data/doc/rdoc/more/classes/Settings/Setting.html +0 -223
  525. data/doc/rdoc/more/classes/Settings/SettingCollection.html +0 -144
  526. data/doc/rdoc/more/classes/SimpleStringIO.html +0 -135
  527. data/doc/rdoc/more/classes/Snapshot.html +0 -194
  528. data/doc/rdoc/more/classes/Snapshot/ValueHolder.html +0 -163
  529. data/doc/rdoc/more/classes/SparseArray.html +0 -1397
  530. data/doc/rdoc/more/classes/Stash.html +0 -232
  531. data/doc/rdoc/more/classes/String/Mask.html +0 -555
  532. data/doc/rdoc/more/classes/String/Words.html +0 -328
  533. data/doc/rdoc/more/classes/Struct.html +0 -130
  534. data/doc/rdoc/more/classes/SyncArray.html +0 -127
  535. data/doc/rdoc/more/classes/SyncHash.html +0 -158
  536. data/doc/rdoc/more/classes/SyncHash/Delegator.html +0 -211
  537. data/doc/rdoc/more/classes/SyncHash/Inheritor.html +0 -211
  538. data/doc/rdoc/more/classes/System.html +0 -1117
  539. data/doc/rdoc/more/classes/Timer.html +0 -464
  540. data/doc/rdoc/more/classes/Timer/Dummy.html +0 -139
  541. data/doc/rdoc/more/classes/TracePoint.html +0 -455
  542. data/doc/rdoc/more/classes/Tuple.html +0 -900
  543. data/doc/rdoc/more/classes/TypeCast.html +0 -158
  544. data/doc/rdoc/more/classes/TypeCast/Class.html +0 -127
  545. data/doc/rdoc/more/classes/TypeCast/Object.html +0 -117
  546. data/doc/rdoc/more/classes/TypeCastException.html +0 -96
  547. data/doc/rdoc/more/classes/Uninheritable.html +0 -120
  548. data/doc/rdoc/more/classes/VersionNumber.html +0 -408
  549. data/doc/rdoc/more/classes/X.html +0 -117
  550. data/doc/rdoc/more/classes/XOXO.html +0 -189
  551. data/doc/rdoc/more/classes/ZipUtils.html +0 -568
  552. data/doc/rdoc/more/classes/ZipUtils/DryRun.html +0 -391
  553. data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +0 -391
  554. data/doc/rdoc/more/classes/ZipUtils/Verbose.html +0 -361
  555. data/doc/rdoc/more/created.rid +0 -1
  556. data/doc/rdoc/more/files/README.html +0 -286
  557. data/doc/rdoc/more/files/doc/README_more.html +0 -141
  558. data/doc/rdoc/more/files/lib/more/facets/1stclassmethod_rb.html +0 -181
  559. data/doc/rdoc/more/files/lib/more/facets/advisable_rb.html +0 -124
  560. data/doc/rdoc/more/files/lib/more/facets/ansicode_rb.html +0 -200
  561. data/doc/rdoc/more/files/lib/more/facets/argvector_rb.html +0 -142
  562. data/doc/rdoc/more/files/lib/more/facets/association_rb.html +0 -158
  563. data/doc/rdoc/more/files/lib/more/facets/attr_rb.html +0 -92
  564. data/doc/rdoc/more/files/lib/more/facets/autoarray_rb.html +0 -125
  565. data/doc/rdoc/more/files/lib/more/facets/autoreload_rb.html +0 -134
  566. data/doc/rdoc/more/files/lib/more/facets/basex_rb.html +0 -92
  567. data/doc/rdoc/more/files/lib/more/facets/bbcode_rb.html +0 -138
  568. data/doc/rdoc/more/files/lib/more/facets/bicrypt_rb.html +0 -124
  569. data/doc/rdoc/more/files/lib/more/facets/binding/opvars_rb.html +0 -96
  570. data/doc/rdoc/more/files/lib/more/facets/binreadable_rb.html +0 -141
  571. data/doc/rdoc/more/files/lib/more/facets/blankslate_rb.html +0 -92
  572. data/doc/rdoc/more/files/lib/more/facets/buildable_rb.html +0 -230
  573. data/doc/rdoc/more/files/lib/more/facets/capsule_rb.html +0 -143
  574. data/doc/rdoc/more/files/lib/more/facets/class_extension_rb.html +0 -155
  575. data/doc/rdoc/more/files/lib/more/facets/classmethods_rb.html +0 -213
  576. data/doc/rdoc/more/files/lib/more/facets/cloneable_rb.html +0 -134
  577. data/doc/rdoc/more/files/lib/more/facets/consoleutils_rb.html +0 -92
  578. data/doc/rdoc/more/files/lib/more/facets/coroutine_rb.html +0 -163
  579. data/doc/rdoc/more/files/lib/more/facets/crypt_rb.html +0 -141
  580. data/doc/rdoc/more/files/lib/more/facets/cssfilter_rb.html +0 -121
  581. data/doc/rdoc/more/files/lib/more/facets/daemonize_rb.html +0 -118
  582. data/doc/rdoc/more/files/lib/more/facets/dependency_rb.html +0 -158
  583. data/doc/rdoc/more/files/lib/more/facets/dictionary_rb.html +0 -201
  584. data/doc/rdoc/more/files/lib/more/facets/downloader_rb.html +0 -137
  585. data/doc/rdoc/more/files/lib/more/facets/duplicable_rb.html +0 -100
  586. data/doc/rdoc/more/files/lib/more/facets/duration_rb.html +0 -92
  587. data/doc/rdoc/more/files/lib/more/facets/elementor_rb.html +0 -149
  588. data/doc/rdoc/more/files/lib/more/facets/elementwise_rb.html +0 -96
  589. data/doc/rdoc/more/files/lib/more/facets/enumerablepass_rb.html +0 -154
  590. data/doc/rdoc/more/files/lib/more/facets/equatable_rb.html +0 -146
  591. data/doc/rdoc/more/files/lib/more/facets/expirable_rb.html +0 -116
  592. data/doc/rdoc/more/files/lib/more/facets/fileable_rb.html +0 -138
  593. data/doc/rdoc/more/files/lib/more/facets/filelist_rb.html +0 -165
  594. data/doc/rdoc/more/files/lib/more/facets/filter_rb.html +0 -97
  595. data/doc/rdoc/more/files/lib/more/facets/heap_rb.html +0 -132
  596. data/doc/rdoc/more/files/lib/more/facets/hook_rb.html +0 -96
  597. data/doc/rdoc/more/files/lib/more/facets/htmlfilter_rb.html +0 -153
  598. data/doc/rdoc/more/files/lib/more/facets/infinity_rb.html +0 -153
  599. data/doc/rdoc/more/files/lib/more/facets/inheritor_rb.html +0 -124
  600. data/doc/rdoc/more/files/lib/more/facets/ini_rb.html +0 -105
  601. data/doc/rdoc/more/files/lib/more/facets/instantiable_rb.html +0 -119
  602. data/doc/rdoc/more/files/lib/more/facets/instantise_rb.html +0 -96
  603. data/doc/rdoc/more/files/lib/more/facets/instantize_rb.html +0 -160
  604. data/doc/rdoc/more/files/lib/more/facets/interval_rb.html +0 -163
  605. data/doc/rdoc/more/files/lib/more/facets/ioredirect_rb.html +0 -133
  606. data/doc/rdoc/more/files/lib/more/facets/iteration_rb.html +0 -94
  607. data/doc/rdoc/more/files/lib/more/facets/kernel/meta_rb.html +0 -96
  608. data/doc/rdoc/more/files/lib/more/facets/linkedlist_rb.html +0 -159
  609. data/doc/rdoc/more/files/lib/more/facets/lrucache_rb.html +0 -129
  610. data/doc/rdoc/more/files/lib/more/facets/main_rb.html +0 -126
  611. data/doc/rdoc/more/files/lib/more/facets/matcher_rb.html +0 -97
  612. data/doc/rdoc/more/files/lib/more/facets/memoize_rb.html +0 -164
  613. data/doc/rdoc/more/files/lib/more/facets/memoizer_rb.html +0 -152
  614. data/doc/rdoc/more/files/lib/more/facets/methodspace_rb.html +0 -138
  615. data/doc/rdoc/more/files/lib/more/facets/minitar_rb.html +0 -203
  616. data/doc/rdoc/more/files/lib/more/facets/multipliers_rb.html +0 -132
  617. data/doc/rdoc/more/files/lib/more/facets/multiton_rb.html +0 -187
  618. data/doc/rdoc/more/files/lib/more/facets/nackclass_rb.html +0 -120
  619. data/doc/rdoc/more/files/lib/more/facets/net/smtp_tls_rb.html +0 -143
  620. data/doc/rdoc/more/files/lib/more/facets/nilstatus_rb.html +0 -92
  621. data/doc/rdoc/more/files/lib/more/facets/nullclass_rb.html +0 -122
  622. data/doc/rdoc/more/files/lib/more/facets/opencascade_rb.html +0 -114
  623. data/doc/rdoc/more/files/lib/more/facets/opencollection_rb.html +0 -123
  624. data/doc/rdoc/more/files/lib/more/facets/openhash_rb.html +0 -107
  625. data/doc/rdoc/more/files/lib/more/facets/openmodule_rb.html +0 -92
  626. data/doc/rdoc/more/files/lib/more/facets/openobject_rb.html +0 -169
  627. data/doc/rdoc/more/files/lib/more/facets/opesc_rb.html +0 -94
  628. data/doc/rdoc/more/files/lib/more/facets/orderedhash_rb.html +0 -143
  629. data/doc/rdoc/more/files/lib/more/facets/ostructable_rb.html +0 -92
  630. data/doc/rdoc/more/files/lib/more/facets/overload_rb.html +0 -119
  631. data/doc/rdoc/more/files/lib/more/facets/paramix_rb.html +0 -135
  632. data/doc/rdoc/more/files/lib/more/facets/partial_rb.html +0 -124
  633. data/doc/rdoc/more/files/lib/more/facets/pathlist_rb.html +0 -133
  634. data/doc/rdoc/more/files/lib/more/facets/platform_rb.html +0 -103
  635. data/doc/rdoc/more/files/lib/more/facets/pool_rb.html +0 -131
  636. data/doc/rdoc/more/files/lib/more/facets/pqueue_rb.html +0 -128
  637. data/doc/rdoc/more/files/lib/more/facets/progressbar_rb.html +0 -126
  638. data/doc/rdoc/more/files/lib/more/facets/prototype_rb.html +0 -102
  639. data/doc/rdoc/more/files/lib/more/facets/random_rb.html +0 -149
  640. data/doc/rdoc/more/files/lib/more/facets/rbsystem_rb.html +0 -144
  641. data/doc/rdoc/more/files/lib/more/facets/recorder_rb.html +0 -154
  642. data/doc/rdoc/more/files/lib/more/facets/reference_rb.html +0 -130
  643. data/doc/rdoc/more/files/lib/more/facets/reflection_rb.html +0 -134
  644. data/doc/rdoc/more/files/lib/more/facets/registerable_rb.html +0 -98
  645. data/doc/rdoc/more/files/lib/more/facets/rwdelegator_rb.html +0 -122
  646. data/doc/rdoc/more/files/lib/more/facets/semaphore_rb.html +0 -120
  647. data/doc/rdoc/more/files/lib/more/facets/settings_rb.html +0 -141
  648. data/doc/rdoc/more/files/lib/more/facets/snapshot_rb.html +0 -177
  649. data/doc/rdoc/more/files/lib/more/facets/sparse_array_rb.html +0 -92
  650. data/doc/rdoc/more/files/lib/more/facets/stash_rb.html +0 -166
  651. data/doc/rdoc/more/files/lib/more/facets/string/mask_rb.html +0 -96
  652. data/doc/rdoc/more/files/lib/more/facets/string/words_rb.html +0 -96
  653. data/doc/rdoc/more/files/lib/more/facets/succ_rb.html +0 -92
  654. data/doc/rdoc/more/files/lib/more/facets/syncarray_rb.html +0 -125
  655. data/doc/rdoc/more/files/lib/more/facets/synchash_rb.html +0 -138
  656. data/doc/rdoc/more/files/lib/more/facets/thread_rb.html +0 -132
  657. data/doc/rdoc/more/files/lib/more/facets/timer_rb.html +0 -174
  658. data/doc/rdoc/more/files/lib/more/facets/tracepoint_rb.html +0 -172
  659. data/doc/rdoc/more/files/lib/more/facets/tuple_rb.html +0 -160
  660. data/doc/rdoc/more/files/lib/more/facets/typecast_rb.html +0 -215
  661. data/doc/rdoc/more/files/lib/more/facets/uninheritable_rb.html +0 -129
  662. data/doc/rdoc/more/files/lib/more/facets/version_rb.html +0 -132
  663. data/doc/rdoc/more/files/lib/more/facets/xmlhash_rb.html +0 -97
  664. data/doc/rdoc/more/files/lib/more/facets/xoxo_rb.html +0 -136
  665. data/doc/rdoc/more/files/lib/more/facets/ziputils_rb.html +0 -105
  666. data/doc/rdoc/more/fr_class_index.html +0 -185
  667. data/doc/rdoc/more/fr_file_index.html +0 -156
  668. data/doc/rdoc/more/fr_method_index.html +0 -1132
  669. data/doc/rdoc/more/index.html +0 -26
  670. data/doc/rdoc/more/rdoc-style.css +0 -177
  671. data/lib/core/facets/kernel/__here__.rb +0 -8
  672. data/lib/more/facets/buildable.rb +0 -344
  673. data/lib/more/facets/cssfilter.rb +0 -254
  674. data/lib/more/facets/htmlfilter.rb +0 -595
  675. data/lib/more/facets/kernel/meta.rb +0 -32
  676. data/lib/more/facets/prototype.rb +0 -88
  677. data/lib/more/facets/rwdelegator.rb +0 -74
@@ -1,262 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
- <html>
6
- <head>
7
- <title>Module: Stackable</title>
8
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
10
-
11
- <script language="JavaScript" type="text/javascript">
12
- // <![CDATA[
13
-
14
- function toggleSource( id )
15
- {
16
- var elem
17
- var link
18
-
19
- if( document.getElementById )
20
- {
21
- elem = document.getElementById( id )
22
- link = document.getElementById( "l_" + id )
23
- }
24
- else if ( document.all )
25
- {
26
- elem = eval( "document.all." + id )
27
- link = eval( "document.all.l_" + id )
28
- }
29
- else
30
- return false;
31
-
32
- if( elem.style.display == "block" )
33
- {
34
- elem.style.display = "none"
35
- link.innerHTML = "+"
36
- }
37
- else
38
- {
39
- elem.style.display = "block"
40
- link.innerHTML = "-"
41
- }
42
- }
43
-
44
- function openCode( url )
45
- {
46
- window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
- }
48
- // ]]>
49
- </script>
50
- </head>
51
-
52
- <body>
53
- <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
- <td class="file-title"><span class="file-title-prefix">Module</span><br />Stackable</td>
55
- <td align="right">
56
- <table cellspacing="0" cellpadding="2">
57
- <tr valign="top">
58
- <td>In:</td>
59
- <td>
60
- <a href="../files/lib/core/facets/stackable_rb.html">lib/core/facets/stackable.rb</a>
61
- </td>
62
- </tr>
63
- </table>
64
- </td>
65
- </tr>
66
- </table>
67
- <!-- banner header -->
68
-
69
- <div id="bodyContent">
70
- <div id="content">
71
-
72
- <div class="description"><h1><a href="Stackable.html">Stackable</a></h1>
73
- <p>
74
- <a href="Stackable.html">Stackable</a> mixin provides <a
75
- href="Stackable.html#M000353">pop</a>, <a
76
- href="Stackable.html#M000354">push</a>, <a
77
- href="Stackable.html#M000355">pull</a>, etc. It depends on slice, splice
78
- and insert.
79
- </p>
80
- </div>
81
-
82
-
83
-
84
- <div class="sectiontitle">Methods</div>
85
- <span style="padding-right: 5px;"><a href="#M000359">peek</a></span>
86
- <span style="padding-right: 5px;"><a href="#M000357">poke</a></span>
87
- <span style="padding-right: 5px;"><a href="#M000353">pop</a></span>
88
- <span style="padding-right: 5px;"><a href="#M000355">pull</a></span>
89
- <span style="padding-right: 5px;"><a href="#M000354">push</a></span>
90
- <span style="padding-right: 5px;"><a href="#M000356">shift</a></span>
91
- <span style="padding-right: 5px;"><a href="#M000358">unshift</a></span>
92
-
93
-
94
-
95
-
96
-
97
-
98
- <div class="sectiontitle">Public Instance methods</div>
99
- <div class="method">
100
- <div class="title">
101
- <a name="M000359"></a><b>peek</b>()
102
- </div>
103
- <div class="description">
104
- <p>
105
- Peek at the top of the stack.
106
- </p>
107
- <pre>
108
- a = [1, 2, 3]
109
- a.peek #=&gt; 3
110
- a #=&gt; [1, 2, 3]
111
- </pre>
112
- </div>
113
- <div class="sourcecode">
114
- <p class="source-link">[ <a href="javascript:toggleSource('M000359_source')" id="l_M000359_source">+</a> ]</p>
115
- <div id="M000359_source" class="dyn-source">
116
- <pre>
117
- <span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 81</span>
118
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">peek</span>
119
- <span class="ruby-identifier">slice</span>(<span class="ruby-value">-1</span>)
120
- <span class="ruby-keyword kw">end</span>
121
- </pre>
122
- </div>
123
- </div>
124
- </div>
125
- <div class="method">
126
- <div class="title">
127
- <a name="M000357"></a><b>poke</b>(x)
128
- </div>
129
- <div class="description">
130
- <p>
131
- Poke item onto the stack.
132
- </p>
133
- <pre>
134
- a = [2, 3]
135
- a.poke(1) #=&gt; [1, 2, 3]
136
-
137
- TODO: Better name (besides unshift)?
138
- </pre>
139
- </div>
140
- <div class="aka">
141
- This method is also aliased as
142
- <a href="Stackable.html#M000358">unshift</a>
143
- </div>
144
- <div class="sourcecode">
145
- <p class="source-link">[ <a href="javascript:toggleSource('M000357_source')" id="l_M000357_source">+</a> ]</p>
146
- <div id="M000357_source" class="dyn-source">
147
- <pre>
148
- <span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 69</span>
149
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">poke</span>(<span class="ruby-identifier">x</span>)
150
- <span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>,<span class="ruby-identifier">x</span>)
151
- <span class="ruby-keyword kw">end</span>
152
- </pre>
153
- </div>
154
- </div>
155
- </div>
156
- <div class="method">
157
- <div class="title">
158
- <a name="M000353"></a><b>pop</b>()
159
- </div>
160
- <div class="description">
161
- <p>
162
- Pop item off stack.
163
- </p>
164
- <pre>
165
- a = [1, 2, 3]
166
- a.pop #=&gt; 3
167
- a #=&gt; [1, 2]
168
- </pre>
169
- </div>
170
- <div class="sourcecode">
171
- <p class="source-link">[ <a href="javascript:toggleSource('M000353_source')" id="l_M000353_source">+</a> ]</p>
172
- <div id="M000353_source" class="dyn-source">
173
- <pre>
174
- <span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 37</span>
175
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pop</span>
176
- <span class="ruby-identifier">splice</span>(<span class="ruby-value">-1</span>)
177
- <span class="ruby-keyword kw">end</span>
178
- </pre>
179
- </div>
180
- </div>
181
- </div>
182
- <div class="method">
183
- <div class="title">
184
- <a name="M000355"></a><b>pull</b>()
185
- </div>
186
- <div class="description">
187
- <p>
188
- Pull item off the stack.
189
- </p>
190
- <pre>
191
- a = [1, 2, 3]
192
- a.pull #=&gt; 1
193
- a #=&gt; [2, 3]
194
- </pre>
195
- </div>
196
- <div class="aka">
197
- This method is also aliased as
198
- <a href="Stackable.html#M000356">shift</a>
199
- </div>
200
- <div class="sourcecode">
201
- <p class="source-link">[ <a href="javascript:toggleSource('M000355_source')" id="l_M000355_source">+</a> ]</p>
202
- <div id="M000355_source" class="dyn-source">
203
- <pre>
204
- <span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 56</span>
205
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull</span>
206
- <span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>)
207
- <span class="ruby-keyword kw">end</span>
208
- </pre>
209
- </div>
210
- </div>
211
- </div>
212
- <div class="method">
213
- <div class="title">
214
- <a name="M000354"></a><b>push</b>(x)
215
- </div>
216
- <div class="description">
217
- <p>
218
- Push item onto the stack.
219
- </p>
220
- <pre>
221
- a = [1, 2]
222
- a.push(3) #=&gt; [1, 2, 3]
223
- </pre>
224
- </div>
225
- <div class="sourcecode">
226
- <p class="source-link">[ <a href="javascript:toggleSource('M000354_source')" id="l_M000354_source">+</a> ]</p>
227
- <div id="M000354_source" class="dyn-source">
228
- <pre>
229
- <span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 46</span>
230
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push</span>(<span class="ruby-identifier">x</span>)
231
- <span class="ruby-identifier">insert</span>(<span class="ruby-value">-1</span>,<span class="ruby-identifier">x</span>)
232
- <span class="ruby-keyword kw">end</span>
233
- </pre>
234
- </div>
235
- </div>
236
- </div>
237
- <div class="method">
238
- <div class="title">
239
- <a name="M000356"></a><b>shift</b>()
240
- </div>
241
- <div class="description">
242
- <p>
243
- Alias for <a href="Stackable.html#M000355">pull</a>
244
- </p>
245
- </div>
246
- </div>
247
- <div class="method">
248
- <div class="title">
249
- <a name="M000358"></a><b>unshift</b>(x)
250
- </div>
251
- <div class="description">
252
- <p>
253
- Alias for <a href="Stackable.html#M000357">poke</a>
254
- </p>
255
- </div>
256
- </div>
257
- </div>
258
-
259
- </div>
260
-
261
- </body>
262
- </html>
@@ -1,2332 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
- <html>
6
- <head>
7
- <title>Class: String</title>
8
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
9
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
10
-
11
- <script language="JavaScript" type="text/javascript">
12
- // <![CDATA[
13
-
14
- function toggleSource( id )
15
- {
16
- var elem
17
- var link
18
-
19
- if( document.getElementById )
20
- {
21
- elem = document.getElementById( id )
22
- link = document.getElementById( "l_" + id )
23
- }
24
- else if ( document.all )
25
- {
26
- elem = eval( "document.all." + id )
27
- link = eval( "document.all.l_" + id )
28
- }
29
- else
30
- return false;
31
-
32
- if( elem.style.display == "block" )
33
- {
34
- elem.style.display = "none"
35
- link.innerHTML = "+"
36
- }
37
- else
38
- {
39
- elem.style.display = "block"
40
- link.innerHTML = "-"
41
- }
42
- }
43
-
44
- function openCode( url )
45
- {
46
- window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
- }
48
- // ]]>
49
- </script>
50
- </head>
51
-
52
- <body>
53
- <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
54
- <td class="file-title"><span class="file-title-prefix">Class</span><br />String</td>
55
- <td align="right">
56
- <table cellspacing="0" cellpadding="2">
57
- <tr valign="top">
58
- <td>In:</td>
59
- <td>
60
- <a href="../files/lib/core/facets/boolean_rb.html">lib/core/facets/boolean.rb</a>
61
- <a href="../files/lib/core/facets/comparable/cmp_rb.html">lib/core/facets/comparable/cmp.rb</a>
62
- <a href="../files/lib/core/facets/string/shatter_rb.html">lib/core/facets/string/shatter.rb</a>
63
- <a href="../files/lib/core/facets/string/file_rb.html">lib/core/facets/string/file.rb</a>
64
- <a href="../files/lib/core/facets/string/to_re_rb.html">lib/core/facets/string/to_re.rb</a>
65
- <a href="../files/lib/core/facets/string/fold_rb.html">lib/core/facets/string/fold.rb</a>
66
- <a href="../files/lib/core/facets/string/start_with_rb.html">lib/core/facets/string/start_with.rb</a>
67
- <a href="../files/lib/core/facets/string/camelcase_rb.html">lib/core/facets/string/camelcase.rb</a>
68
- <a href="../files/lib/core/facets/string/lines_rb.html">lib/core/facets/string/lines.rb</a>
69
- <a href="../files/lib/core/facets/string/modulize_rb.html">lib/core/facets/string/modulize.rb</a>
70
- <a href="../files/lib/core/facets/string/word_wrap_rb.html">lib/core/facets/string/word_wrap.rb</a>
71
- <a href="../files/lib/core/facets/string/align_rb.html">lib/core/facets/string/align.rb</a>
72
- <a href="../files/lib/core/facets/string/tab_rb.html">lib/core/facets/string/tab.rb</a>
73
- <a href="../files/lib/core/facets/string/methodize_rb.html">lib/core/facets/string/methodize.rb</a>
74
- <a href="../files/lib/core/facets/string/op_sub_rb.html">lib/core/facets/string/op_sub.rb</a>
75
- <a href="../files/lib/core/facets/string/compress_lines_rb.html">lib/core/facets/string/compress_lines.rb</a>
76
- <a href="../files/lib/core/facets/string/range_rb.html">lib/core/facets/string/range.rb</a>
77
- <a href="../files/lib/core/facets/string/snakecase_rb.html">lib/core/facets/string/snakecase.rb</a>
78
- <a href="../files/lib/core/facets/string/each_char_rb.html">lib/core/facets/string/each_char.rb</a>
79
- <a href="../files/lib/core/facets/string/divide_rb.html">lib/core/facets/string/divide.rb</a>
80
- <a href="../files/lib/core/facets/string/margin_rb.html">lib/core/facets/string/margin.rb</a>
81
- <a href="../files/lib/core/facets/string/mscan_rb.html">lib/core/facets/string/mscan.rb</a>
82
- <a href="../files/lib/core/facets/string/capitalized_rb.html">lib/core/facets/string/capitalized.rb</a>
83
- <a href="../files/lib/core/facets/string/expand_tab_rb.html">lib/core/facets/string/expand_tab.rb</a>
84
- <a href="../files/lib/core/facets/string/natcmp_rb.html">lib/core/facets/string/natcmp.rb</a>
85
- <a href="../files/lib/core/facets/string/variablize_rb.html">lib/core/facets/string/variablize.rb</a>
86
- <a href="../files/lib/core/facets/string/bytes_rb.html">lib/core/facets/string/bytes.rb</a>
87
- <a href="../files/lib/core/facets/string/pathize_rb.html">lib/core/facets/string/pathize.rb</a>
88
- <a href="../files/lib/core/facets/string/indent_rb.html">lib/core/facets/string/indent.rb</a>
89
- <a href="../files/lib/core/facets/string/titlecase_rb.html">lib/core/facets/string/titlecase.rb</a>
90
- <a href="../files/lib/core/facets/string/tabto_rb.html">lib/core/facets/string/tabto.rb</a>
91
- <a href="../files/lib/core/facets/string/words_rb.html">lib/core/facets/string/words.rb</a>
92
- <a href="../files/lib/core/facets/string/interpolate_rb.html">lib/core/facets/string/interpolate.rb</a>
93
- <a href="../files/lib/core/facets/string/cleave_rb.html">lib/core/facets/string/cleave.rb</a>
94
- <a href="../files/lib/core/facets/string/line_wrap_rb.html">lib/core/facets/string/line_wrap.rb</a>
95
- <a href="../files/lib/core/facets/string/bracket_rb.html">lib/core/facets/string/bracket.rb</a>
96
- <a href="../files/lib/core/facets/string/chars_rb.html">lib/core/facets/string/chars.rb</a>
97
- <a href="../files/lib/core/facets/string/chomp_rb.html">lib/core/facets/string/chomp.rb</a>
98
- <a href="../files/lib/core/facets/string/splice_rb.html">lib/core/facets/string/splice.rb</a>
99
- <a href="../files/lib/core/facets/string/rewrite_rb.html">lib/core/facets/string/rewrite.rb</a>
100
- <a href="../files/lib/core/facets/string/nchar_rb.html">lib/core/facets/string/nchar.rb</a>
101
- <a href="../files/lib/core/facets/string/xor_rb.html">lib/core/facets/string/xor.rb</a>
102
- <a href="../files/lib/core/facets/string/each_word_rb.html">lib/core/facets/string/each_word.rb</a>
103
- <a href="../files/lib/core/facets/blank_rb.html">lib/core/facets/blank.rb</a>
104
- </td>
105
- </tr>
106
- <tr>
107
- <td>Parent:</td>
108
- <td>
109
- <a href="Object.html">
110
- Object
111
- </a>
112
- </td>
113
- </tr>
114
- </table>
115
- </td>
116
- </tr>
117
- </table>
118
- <!-- banner header -->
119
-
120
- <div id="bodyContent">
121
- <div id="content">
122
-
123
-
124
-
125
-
126
- <div class="sectiontitle">Methods</div>
127
- <span style="padding-right: 5px;"><a href="#M000289">-</a></span>
128
- <span style="padding-right: 5px;"><a href="#M000329">^</a></span>
129
- <span style="padding-right: 5px;"><a href="#M000283">align</a></span>
130
- <span style="padding-right: 5px;"><a href="#M000286">align_center</a></span>
131
- <span style="padding-right: 5px;"><a href="#M000285">align_left</a></span>
132
- <span style="padding-right: 5px;"><a href="#M000284">align_right</a></span>
133
- <span style="padding-right: 5px;"><a href="#M000331">blank?</a></span>
134
- <span style="padding-right: 5px;"><a href="#M000317">bracket</a></span>
135
- <span style="padding-right: 5px;"><a href="#M000318">bracket!</a></span>
136
- <span style="padding-right: 5px;"><a href="#M000307">bytes</a></span>
137
- <span style="padding-right: 5px;"><a href="#M000278">camelcase</a></span>
138
- <span style="padding-right: 5px;"><a href="#M000300">capitalized?</a></span>
139
- <span style="padding-right: 5px;"><a href="#M000323">chars</a></span>
140
- <span style="padding-right: 5px;"><a href="#M000315">cleave</a></span>
141
- <span style="padding-right: 5px;"><a href="#M000270">cmp</a></span>
142
- <span style="padding-right: 5px;"><a href="#M000290">compress_lines</a></span>
143
- <span style="padding-right: 5px;"><a href="#M000322">dequote</a></span>
144
- <span style="padding-right: 5px;"><a href="#M000297">divide</a></span>
145
- <span style="padding-right: 5px;"><a href="#M000301">downcase?</a></span>
146
- <span style="padding-right: 5px;"><a href="#M000296">each_char</a></span>
147
- <span style="padding-right: 5px;"><a href="#M000330">each_word</a></span>
148
- <span style="padding-right: 5px;"><a href="#M000277">end_with?</a></span>
149
- <span style="padding-right: 5px;"><a href="#M000303">expand_tab</a></span>
150
- <span style="padding-right: 5px;"><a href="#M000304">expand_tabs</a></span>
151
- <span style="padding-right: 5px;"><a href="#M000272">file</a></span>
152
- <span style="padding-right: 5px;"><a href="#M000275">fold</a></span>
153
- <span style="padding-right: 5px;"><a href="#M000309">indent</a></span>
154
- <span style="padding-right: 5px;"><a href="#M000294">index_all</a></span>
155
- <span style="padding-right: 5px;"><a href="#M000314">interpolate</a></span>
156
- <span style="padding-right: 5px;"><a href="#M000324">lchomp</a></span>
157
- <span style="padding-right: 5px;"><a href="#M000325">lchomp!</a></span>
158
- <span style="padding-right: 5px;"><a href="#M000316">line_wrap</a></span>
159
- <span style="padding-right: 5px;"><a href="#M000279">lines</a></span>
160
- <span style="padding-right: 5px;"><a href="#M000298">margin</a></span>
161
- <span style="padding-right: 5px;"><a href="#M000288">methodize</a></span>
162
- <span style="padding-right: 5px;"><a href="#M000280">modulize</a></span>
163
- <span style="padding-right: 5px;"><a href="#M000299">mscan</a></span>
164
- <span style="padding-right: 5px;"><a href="#M000305">natcmp</a></span>
165
- <span style="padding-right: 5px;"><a href="#M000328">nchar</a></span>
166
- <span style="padding-right: 5px;"><a href="#M000310">outdent</a></span>
167
- <span style="padding-right: 5px;"><a href="#M000308">pathize</a></span>
168
- <span style="padding-right: 5px;"><a href="#M000321">quote</a></span>
169
- <span style="padding-right: 5px;"><a href="#M000291">range</a></span>
170
- <span style="padding-right: 5px;"><a href="#M000292">range_all</a></span>
171
- <span style="padding-right: 5px;"><a href="#M000293">range_of_line</a></span>
172
- <span style="padding-right: 5px;"><a href="#M000327">rewrite</a></span>
173
- <span style="padding-right: 5px;"><a href="#M000271">shatter</a></span>
174
- <span style="padding-right: 5px;"><a href="#M000295">snakecase</a></span>
175
- <span style="padding-right: 5px;"><a href="#M000326">splice</a></span>
176
- <span style="padding-right: 5px;"><a href="#M000276">start_with?</a></span>
177
- <span style="padding-right: 5px;"><a href="#M000287">tab</a></span>
178
- <span style="padding-right: 5px;"><a href="#M000312">tabto</a></span>
179
- <span style="padding-right: 5px;"><a href="#M000311">titlecase</a></span>
180
- <span style="padding-right: 5px;"><a href="#M000269">to_b</a></span>
181
- <span style="padding-right: 5px;"><a href="#M000273">to_re</a></span>
182
- <span style="padding-right: 5px;"><a href="#M000274">to_rx</a></span>
183
- <span style="padding-right: 5px;"><a href="#M000319">unbracket</a></span>
184
- <span style="padding-right: 5px;"><a href="#M000320">unbracket!</a></span>
185
- <span style="padding-right: 5px;"><a href="#M000302">upcase?</a></span>
186
- <span style="padding-right: 5px;"><a href="#M000306">variablize</a></span>
187
- <span style="padding-right: 5px;"><a href="#M000281">word_wrap</a></span>
188
- <span style="padding-right: 5px;"><a href="#M000282">word_wrap!</a></span>
189
- <span style="padding-right: 5px;"><a href="#M000313">words</a></span>
190
-
191
-
192
-
193
-
194
- <div class="sectiontitle">Constants</div>
195
- <table border='0' cellpadding='5'>
196
- <tr valign='top'>
197
- <td class="attr-name">BRA2KET</td>
198
- <td>=</td>
199
- <td class="attr-value">{ '['=&gt;']', '('=&gt;')', '{'=&gt;'}', '&lt;'=&gt;'&gt;' }</td>
200
- </tr>
201
- </table>
202
-
203
-
204
- <div class="sectiontitle">Public Class methods</div>
205
- <div class="method">
206
- <div class="title">
207
- <a name="M000314"></a><b>interpolate</b>(&amp;str)
208
- </div>
209
- <div class="description">
210
- <p>
211
- Interpolate. Provides a means of extenally using Ruby string interpolation
212
- mechinism.
213
- </p>
214
- <pre>
215
- try = &quot;hello&quot;
216
- str = &quot;\#{try}!!!&quot;
217
- String.interpolate{ str } #=&gt; &quot;hello!!!&quot;
218
-
219
- NOTE: The block neccessary in order to get
220
- then binding of the caller.
221
- </pre>
222
- <p>
223
- CREDIT: Trans
224
- </p>
225
- </div>
226
- <div class="sourcecode">
227
- <p class="source-link">[ <a href="javascript:toggleSource('M000314_source')" id="l_M000314_source">+</a> ]</p>
228
- <div id="M000314_source" class="dyn-source">
229
- <pre>
230
- <span class="ruby-comment cmt"># File lib/core/facets/string/interpolate.rb, line 15</span>
231
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">interpolate</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">str</span>)
232
- <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;%{#{str.call}}&quot;</span>, <span class="ruby-identifier">str</span>.<span class="ruby-identifier">binding</span>
233
- <span class="ruby-keyword kw">end</span>
234
- </pre>
235
- </div>
236
- </div>
237
- </div>
238
- <div class="sectiontitle">Public Instance methods</div>
239
- <div class="method">
240
- <div class="title">
241
- <a name="M000289"></a><b>-</b>(pattern)
242
- </div>
243
- <div class="description">
244
- <p>
245
- Removes occurances of a string or regexp.
246
- </p>
247
- <pre>
248
- &quot;HELLO HELLO&quot; - &quot;LL&quot; #=&gt; &quot;HEO HEO&quot;
249
- </pre>
250
- <p>
251
- CREDIT: Benjamin David Oakes
252
- </p>
253
- </div>
254
- <div class="sourcecode">
255
- <p class="source-link">[ <a href="javascript:toggleSource('M000289_source')" id="l_M000289_source">+</a> ]</p>
256
- <div id="M000289_source" class="dyn-source">
257
- <pre>
258
- <span class="ruby-comment cmt"># File lib/core/facets/string/op_sub.rb, line 9</span>
259
- <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">pattern</span>)
260
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-value str">''</span>)
261
- <span class="ruby-keyword kw">end</span>
262
- </pre>
263
- </div>
264
- </div>
265
- </div>
266
- <div class="method">
267
- <div class="title">
268
- <a name="M000329"></a><b>^</b>(aString)
269
- </div>
270
- <div class="description">
271
- <p>
272
- Binary XOR of two strings.
273
- </p>
274
- <pre>
275
- puts &quot;\000\000\001\001&quot; ^ &quot;\000\001\000\001&quot;
276
- puts &quot;\003\003\003&quot; ^ &quot;\000\001\002&quot;
277
- </pre>
278
- <p>
279
- <em>produces</em>
280
- </p>
281
- <pre>
282
- &quot;\000\001\001\000&quot;
283
- &quot;\003\002\001&quot;
284
- </pre>
285
- </div>
286
- <div class="sourcecode">
287
- <p class="source-link">[ <a href="javascript:toggleSource('M000329_source')" id="l_M000329_source">+</a> ]</p>
288
- <div id="M000329_source" class="dyn-source">
289
- <pre>
290
- <span class="ruby-comment cmt"># File lib/core/facets/string/xor.rb, line 13</span>
291
- <span class="ruby-keyword kw">def</span> <span class="ruby-operator">^</span>(<span class="ruby-identifier">aString</span>)
292
- <span class="ruby-identifier">a</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C'</span><span class="ruby-operator">*</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>))
293
- <span class="ruby-identifier">b</span> = <span class="ruby-identifier">aString</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C'</span><span class="ruby-operator">*</span>(<span class="ruby-identifier">aString</span>.<span class="ruby-identifier">length</span>))
294
- <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">b</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span>)
295
- (<span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">times</span> { <span class="ruby-identifier">b</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value">0</span> }
296
- <span class="ruby-keyword kw">end</span>
297
- <span class="ruby-identifier">xor</span> = <span class="ruby-value str">&quot;&quot;</span>
298
- <span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
299
- <span class="ruby-identifier">x</span> = <span class="ruby-identifier">a</span>[<span class="ruby-identifier">pos</span>] <span class="ruby-operator">^</span> <span class="ruby-identifier">b</span>[<span class="ruby-identifier">pos</span>]
300
- <span class="ruby-identifier">xor</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">chr</span>()
301
- }
302
- <span class="ruby-keyword kw">return</span>(<span class="ruby-identifier">xor</span>)
303
- <span class="ruby-keyword kw">end</span>
304
- </pre>
305
- </div>
306
- </div>
307
- </div>
308
- <div class="method">
309
- <div class="title">
310
- <a name="M000283"></a><b>align</b>(direction, n, sep=&quot;\n&quot;, c=' ')
311
- </div>
312
- <div class="sourcecode">
313
- <p class="source-link">[ <a href="javascript:toggleSource('M000283_source')" id="l_M000283_source">+</a> ]</p>
314
- <div id="M000283_source" class="dyn-source">
315
- <pre>
316
- <span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 3</span>
317
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align</span>(<span class="ruby-identifier">direction</span>, <span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span>)
318
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">direction</span>
319
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:right</span>
320
- <span class="ruby-identifier">align_right</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span>)
321
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:left</span>
322
- <span class="ruby-identifier">align_left</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span>)
323
- <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:center</span>
324
- <span class="ruby-identifier">align_center</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span>)
325
- <span class="ruby-keyword kw">else</span>
326
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>
327
- <span class="ruby-keyword kw">end</span>
328
- <span class="ruby-keyword kw">end</span>
329
- </pre>
330
- </div>
331
- </div>
332
- </div>
333
- <div class="method">
334
- <div class="title">
335
- <a name="M000286"></a><b>align_center</b>(n, sep=&quot;\n&quot;, c=' ')
336
- </div>
337
- <div class="description">
338
- <p>
339
- Centers each line of a string.
340
- </p>
341
- <p>
342
- The default alignment separation is a new line (&quot;\n&quot;). This can
343
- be changed as can be the padding string which defaults to a single space
344
- (&#8217; &#8217;).
345
- </p>
346
- <pre>
347
- s = &lt;&lt;-EOS
348
- This is a test
349
- and
350
- so on
351
- EOS
352
-
353
- puts s.align_center(14)
354
- </pre>
355
- <p>
356
- <em>produces</em>
357
- </p>
358
- <pre>
359
- This is a test
360
- and
361
- so on
362
- </pre>
363
- <p>
364
- CREDIT: Trans
365
- </p>
366
- </div>
367
- <div class="sourcecode">
368
- <p class="source-link">[ <a href="javascript:toggleSource('M000286_source')" id="l_M000286_source">+</a> ]</p>
369
- <div id="M000286_source" class="dyn-source">
370
- <pre>
371
- <span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 98</span>
372
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align_center</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span>)
373
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">center</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sep</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">nil</span>
374
- <span class="ruby-identifier">q</span> = <span class="ruby-identifier">split</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
375
- <span class="ruby-identifier">line</span>.<span class="ruby-identifier">center</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>)
376
- }
377
- <span class="ruby-identifier">q</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>)
378
- <span class="ruby-keyword kw">end</span>
379
- </pre>
380
- </div>
381
- </div>
382
- </div>
383
- <div class="method">
384
- <div class="title">
385
- <a name="M000285"></a><b>align_left</b>(n, sep=&quot;\n&quot;, c=' ')
386
- </div>
387
- <div class="description">
388
- <p>
389
- Align a string to the left.
390
- </p>
391
- <p>
392
- The default alignment separation is a new line (&quot;\n&quot;). This can
393
- be changed as can be the padding string which defaults to a single space
394
- (&#8217; &#8217;).
395
- </p>
396
- <pre>
397
- s = &lt;&lt;-EOS
398
- This is a test
399
- and
400
- so on
401
- EOS
402
-
403
- puts s.align_left(20, &quot;\n&quot;, '.')
404
- </pre>
405
- <p>
406
- <em>produces</em>
407
- </p>
408
- <pre>
409
- This is a test......
410
- and.................
411
- so on...............
412
- </pre>
413
- <p>
414
- CREDIT: Trans
415
- </p>
416
- </div>
417
- <div class="sourcecode">
418
- <p class="source-link">[ <a href="javascript:toggleSource('M000285_source')" id="l_M000285_source">+</a> ]</p>
419
- <div id="M000285_source" class="dyn-source">
420
- <pre>
421
- <span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 68</span>
422
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align_left</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span>)
423
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ljust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sep</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">nil</span>
424
- <span class="ruby-identifier">q</span> = <span class="ruby-identifier">split</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
425
- <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>)
426
- <span class="ruby-keyword kw">end</span>
427
- <span class="ruby-identifier">q</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>)
428
- <span class="ruby-keyword kw">end</span>
429
- </pre>
430
- </div>
431
- </div>
432
- </div>
433
- <div class="method">
434
- <div class="title">
435
- <a name="M000284"></a><b>align_right</b>(n, sep=&quot;\n&quot;, c=' ')
436
- </div>
437
- <div class="description">
438
- <p>
439
- Align a string to the right.
440
- </p>
441
- <p>
442
- The default alignment separation is a new line (&quot;\n&quot;). This can
443
- be changed as can be the padding string which defaults to a single space
444
- (&#8217; &#8217;).
445
- </p>
446
- <pre>
447
- s = &lt;&lt;-EOS
448
- This is a test
449
- and
450
- so on
451
- EOS
452
-
453
- puts s.align_right(14)
454
- </pre>
455
- <p>
456
- <em>produces</em>
457
- </p>
458
- <pre>
459
- This is a test
460
- and
461
- so on
462
- </pre>
463
- <p>
464
- CREDIT: Trans
465
- </p>
466
- </div>
467
- <div class="sourcecode">
468
- <p class="source-link">[ <a href="javascript:toggleSource('M000284_source')" id="l_M000284_source">+</a> ]</p>
469
- <div id="M000284_source" class="dyn-source">
470
- <pre>
471
- <span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 38</span>
472
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align_right</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span>)
473
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rjust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sep</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">nil</span>
474
- <span class="ruby-identifier">q</span> = <span class="ruby-identifier">split</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
475
- <span class="ruby-identifier">line</span>.<span class="ruby-identifier">rjust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>)
476
- <span class="ruby-keyword kw">end</span>
477
- <span class="ruby-identifier">q</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>)
478
- <span class="ruby-keyword kw">end</span>
479
- </pre>
480
- </div>
481
- </div>
482
- </div>
483
- <div class="method">
484
- <div class="title">
485
- <a name="M000331"></a><b>blank?</b>()
486
- </div>
487
- <div class="description">
488
- <p>
489
- Is this string just whitespace?
490
- </p>
491
- <pre>
492
- &quot;abc&quot;.blank? #=&gt; false
493
- &quot; &quot;.blank? #=&gt; true
494
- </pre>
495
- </div>
496
- <div class="sourcecode">
497
- <p class="source-link">[ <a href="javascript:toggleSource('M000331_source')" id="l_M000331_source">+</a> ]</p>
498
- <div id="M000331_source" class="dyn-source">
499
- <pre>
500
- <span class="ruby-comment cmt"># File lib/core/facets/blank.rb, line 50</span>
501
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blank?</span>
502
- <span class="ruby-keyword kw">self</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\S/</span>
503
- <span class="ruby-keyword kw">end</span>
504
- </pre>
505
- </div>
506
- </div>
507
- </div>
508
- <div class="method">
509
- <div class="title">
510
- <a name="M000317"></a><b>bracket</b>(bra, ket=nil)
511
- </div>
512
- <div class="description">
513
- <p>
514
- Return a new string embraced by given brakets. If only one <a
515
- href="String.html#M000317">bracket</a> char is given it will be placed on
516
- either side.
517
- </p>
518
- <pre>
519
- &quot;wrap me&quot;.bracket('{') #=&gt; &quot;{wrap me}&quot;
520
- &quot;wrap me&quot;.bracket('--','!') #=&gt; &quot;--wrap me!&quot;
521
- </pre>
522
- <p>
523
- CREDIT: Trans
524
- </p>
525
- </div>
526
- <div class="sourcecode">
527
- <p class="source-link">[ <a href="javascript:toggleSource('M000317_source')" id="l_M000317_source">+</a> ]</p>
528
- <div id="M000317_source" class="dyn-source">
529
- <pre>
530
- <span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 14</span>
531
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bracket</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
532
- <span class="ruby-comment cmt">#ket = String.bra2ket[$&amp;] if ! ket &amp;&amp; /^[\[({&lt;]$/ =~ bra</span>
533
- <span class="ruby-identifier">ket</span> = <span class="ruby-constant">BRA2KET</span>[<span class="ruby-identifier">bra</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ket</span>
534
- <span class="ruby-node">&quot;#{bra}#{self}#{ket ? ket : bra}&quot;</span>
535
- <span class="ruby-keyword kw">end</span>
536
- </pre>
537
- </div>
538
- </div>
539
- </div>
540
- <div class="method">
541
- <div class="title">
542
- <a name="M000318"></a><b>bracket!</b>(bra, ket=nil)
543
- </div>
544
- <div class="description">
545
- <p>
546
- Inplace version of braket.
547
- </p>
548
- <p>
549
- CREDIT: Trans
550
- </p>
551
- </div>
552
- <div class="sourcecode">
553
- <p class="source-link">[ <a href="javascript:toggleSource('M000318_source')" id="l_M000318_source">+</a> ]</p>
554
- <div id="M000318_source" class="dyn-source">
555
- <pre>
556
- <span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 24</span>
557
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bracket!</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
558
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">bracket</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>))
559
- <span class="ruby-keyword kw">end</span>
560
- </pre>
561
- </div>
562
- </div>
563
- </div>
564
- <div class="method">
565
- <div class="title">
566
- <a name="M000307"></a><b>bytes</b>()
567
- </div>
568
- <div class="description">
569
- <p>
570
- Upacks string into <a href="String.html#M000307">bytes</a>.
571
- </p>
572
- </div>
573
- <div class="sourcecode">
574
- <p class="source-link">[ <a href="javascript:toggleSource('M000307_source')" id="l_M000307_source">+</a> ]</p>
575
- <div id="M000307_source" class="dyn-source">
576
- <pre>
577
- <span class="ruby-comment cmt"># File lib/core/facets/string/bytes.rb, line 8</span>
578
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bytes</span>
579
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C*'</span>)
580
- <span class="ruby-keyword kw">end</span>
581
- </pre>
582
- </div>
583
- </div>
584
- </div>
585
- <div class="method">
586
- <div class="title">
587
- <a name="M000278"></a><b>camelcase</b>(upcase_first_letter=true)
588
- </div>
589
- <div class="description">
590
- <p>
591
- Converts a string to <a href="String.html#M000278">camelcase</a>.
592
- </p>
593
- <p>
594
- By default <a href="String.html#M000278">camelcase</a> convert to
595
- UpperCamelCase, If an argument is set to <tt>false</tt>, then <a
596
- href="String.html#M000278">camelcase</a> will produce lowerCamelCase.
597
- </p>
598
- <p>
599
- <tt><a href="String.html#M000278">camelcase</a></tt> also converts
600
- &#8217;/&#8217; to &#8217;::&#8217; which is useful for converting paths to
601
- namespaces.
602
- </p>
603
- <p>
604
- Examples
605
- </p>
606
- <pre>
607
- &quot;camel_case&quot;.camelcase #=&gt; &quot;CamelCase&quot;
608
- &quot;camel/case&quot;.camelcase #=&gt; &quot;Camel::Case&quot;
609
- &quot;camel_case&quot;.camelcase(false) #=&gt; &quot;camelCase&quot;
610
- </pre>
611
- </div>
612
- <div class="sourcecode">
613
- <p class="source-link">[ <a href="javascript:toggleSource('M000278_source')" id="l_M000278_source">+</a> ]</p>
614
- <div id="M000278_source" class="dyn-source">
615
- <pre>
616
- <span class="ruby-comment cmt"># File lib/core/facets/string/camelcase.rb, line 16</span>
617
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camelcase</span>(<span class="ruby-identifier">upcase_first_letter</span>=<span class="ruby-keyword kw">true</span>)
618
- <span class="ruby-identifier">up</span> = <span class="ruby-identifier">upcase_first_letter</span>
619
- <span class="ruby-identifier">str</span> = <span class="ruby-identifier">dup</span>
620
- <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/(.?)/</span>){ <span class="ruby-node">&quot;::#{$1.upcase}&quot;</span> } <span class="ruby-comment cmt"># NOT SO SURE ABOUT THIS</span>
621
- <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/(?:_+|-+)([a-z])/</span>){ <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }
622
- <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/(\A|\s)([a-z])/</span>){ <span class="ruby-identifier">$1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">up</span>
623
- <span class="ruby-identifier">str</span>
624
- <span class="ruby-keyword kw">end</span>
625
- </pre>
626
- </div>
627
- </div>
628
- </div>
629
- <div class="method">
630
- <div class="title">
631
- <a name="M000300"></a><b>capitalized?</b>()
632
- </div>
633
- <div class="description">
634
- <p>
635
- Return true if the string is capitalized, otherwise false.
636
- </p>
637
- <pre>
638
- &quot;THIS&quot;.capitalized? #=&gt; true
639
- &quot;This&quot;.capitalized? #=&gt; true
640
- &quot;this&quot;.capitalized? #=&gt; false
641
- </pre>
642
- <p>
643
- CREDIT: Phil Tomson
644
- </p>
645
- </div>
646
- <div class="sourcecode">
647
- <p class="source-link">[ <a href="javascript:toggleSource('M000300_source')" id="l_M000300_source">+</a> ]</p>
648
- <div id="M000300_source" class="dyn-source">
649
- <pre>
650
- <span class="ruby-comment cmt"># File lib/core/facets/string/capitalized.rb, line 11</span>
651
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capitalized?</span>
652
- <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[A-Z]/</span>
653
- <span class="ruby-keyword kw">end</span>
654
- </pre>
655
- </div>
656
- </div>
657
- </div>
658
- <div class="method">
659
- <div class="title">
660
- <a name="M000323"></a><b>chars</b>()
661
- </div>
662
- <div class="description">
663
- <p>
664
- Returns an array of characters.
665
- </p>
666
- <pre>
667
- &quot;abc&quot;.chars #=&gt; [&quot;a&quot;,&quot;b&quot;,&quot;c&quot;]
668
- </pre>
669
- </div>
670
- <div class="sourcecode">
671
- <p class="source-link">[ <a href="javascript:toggleSource('M000323_source')" id="l_M000323_source">+</a> ]</p>
672
- <div id="M000323_source" class="dyn-source">
673
- <pre>
674
- <span class="ruby-comment cmt"># File lib/core/facets/string/chars.rb, line 9</span>
675
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chars</span>
676
- <span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>)
677
- <span class="ruby-keyword kw">end</span>
678
- </pre>
679
- </div>
680
- </div>
681
- </div>
682
- <div class="method">
683
- <div class="title">
684
- <a name="M000315"></a><b>cleave</b>(threshold=nil, len=nil)
685
- </div>
686
- <div class="description">
687
- <p>
688
- Cleave a string. Break a string in two parts at the nearest whitespace.
689
- </p>
690
- <p>
691
- CREDIT: Trans
692
- </p>
693
- </div>
694
- <div class="sourcecode">
695
- <p class="source-link">[ <a href="javascript:toggleSource('M000315_source')" id="l_M000315_source">+</a> ]</p>
696
- <div id="M000315_source" class="dyn-source">
697
- <pre>
698
- <span class="ruby-comment cmt"># File lib/core/facets/string/cleave.rb, line 8</span>
699
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleave</span>(<span class="ruby-identifier">threshold</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">len</span>=<span class="ruby-keyword kw">nil</span>)
700
- <span class="ruby-identifier">l</span> = (<span class="ruby-identifier">len</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>)
701
- <span class="ruby-identifier">t</span> = <span class="ruby-identifier">threshold</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">size</span>
702
-
703
- <span class="ruby-identifier">h1</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">l</span>]
704
- <span class="ruby-identifier">h2</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">l</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
705
-
706
- <span class="ruby-identifier">i1</span> = <span class="ruby-identifier">h1</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-regexp re">/\s/</span>) <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
707
- <span class="ruby-identifier">d1</span> = (<span class="ruby-identifier">i1</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">l</span>).<span class="ruby-identifier">abs</span>
708
-
709
- <span class="ruby-identifier">d2</span> = <span class="ruby-identifier">h2</span>.<span class="ruby-identifier">index</span>(<span class="ruby-regexp re">/\s/</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">l</span>
710
- <span class="ruby-identifier">i2</span> = <span class="ruby-identifier">d2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">l</span>
711
-
712
- <span class="ruby-identifier">d1</span> = (<span class="ruby-identifier">i1</span><span class="ruby-operator">-</span><span class="ruby-identifier">l</span>).<span class="ruby-identifier">abs</span>
713
- <span class="ruby-identifier">d2</span> = (<span class="ruby-identifier">i2</span><span class="ruby-operator">-</span><span class="ruby-identifier">l</span>).<span class="ruby-identifier">abs</span>
714
-
715
- <span class="ruby-keyword kw">if</span> [<span class="ruby-identifier">d1</span>, <span class="ruby-identifier">d2</span>].<span class="ruby-identifier">min</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">t</span>
716
- <span class="ruby-identifier">i</span> = <span class="ruby-identifier">t</span>
717
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">d1</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">d2</span>
718
- <span class="ruby-identifier">i</span> = <span class="ruby-identifier">i1</span>
719
- <span class="ruby-keyword kw">else</span>
720
- <span class="ruby-identifier">i</span> = <span class="ruby-identifier">i2</span>
721
- <span class="ruby-keyword kw">end</span>
722
-
723
- <span class="ruby-comment cmt">#dup.insert(l, &quot;\n&quot;).gsub(/^\s+|\s+$/, '')</span>
724
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">i</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>, <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>
725
- <span class="ruby-keyword kw">end</span>
726
- </pre>
727
- </div>
728
- </div>
729
- </div>
730
- <div class="method">
731
- <div class="title">
732
- <a name="M000270"></a><b>cmp</b>(other)
733
- </div>
734
- <div class="description">
735
- <p>
736
- Compare method that takes length into account. Unlike #&lt;=&gt;, this is
737
- compatible with succ.
738
- </p>
739
- <pre>
740
- &quot;abc&quot;.cmp(&quot;abc&quot;) #=&gt; 0
741
- &quot;abcd&quot;.cmp(&quot;abc&quot;) #=&gt; 1
742
- &quot;abc&quot;.cmp(&quot;abcd&quot;) #=&gt; -1
743
- &quot;xyz&quot;.cmp(&quot;abc&quot;) #=&gt; 1
744
- </pre>
745
- <p>
746
- CREDIT: Peter Vanbroekhoven
747
- </p>
748
- </div>
749
- <div class="sourcecode">
750
- <p class="source-link">[ <a href="javascript:toggleSource('M000270_source')" id="l_M000270_source">+</a> ]</p>
751
- <div id="M000270_source" class="dyn-source">
752
- <pre>
753
- <span class="ruby-comment cmt"># File lib/core/facets/comparable/cmp.rb, line 31</span>
754
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmp</span>(<span class="ruby-identifier">other</span>)
755
- <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">length</span>
756
- <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">length</span>
757
- <span class="ruby-keyword kw">self</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span> <span class="ruby-comment cmt"># alphabetic compare</span>
758
- <span class="ruby-keyword kw">end</span>
759
- </pre>
760
- </div>
761
- </div>
762
- </div>
763
- <div class="method">
764
- <div class="title">
765
- <a name="M000290"></a><b>compress_lines</b>(spaced = true)
766
- </div>
767
- <div class="description">
768
- <p>
769
- Matches any whitespace (including newline) and replaces with a single space
770
- </p>
771
- <p>
772
- @example
773
- </p>
774
- <pre>
775
- &lt;&lt;-QUERY.compress_lines
776
- SELECT name
777
- FROM users
778
- QUERY
779
- =&gt; &quot;SELECT name FROM users&quot;
780
- </pre>
781
- </div>
782
- <div class="sourcecode">
783
- <p class="source-link">[ <a href="javascript:toggleSource('M000290_source')" id="l_M000290_source">+</a> ]</p>
784
- <div id="M000290_source" class="dyn-source">
785
- <pre>
786
- <span class="ruby-comment cmt"># File lib/core/facets/string/compress_lines.rb, line 12</span>
787
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compress_lines</span>(<span class="ruby-identifier">spaced</span> = <span class="ruby-keyword kw">true</span>)
788
- <span class="ruby-identifier">split</span>(<span class="ruby-identifier">$/</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">spaced</span> <span class="ruby-value">? </span><span class="ruby-value str">' '</span> <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>)
789
- <span class="ruby-keyword kw">end</span>
790
- </pre>
791
- </div>
792
- </div>
793
- </div>
794
- <div class="method">
795
- <div class="title">
796
- <a name="M000322"></a><b>dequote</b>()
797
- </div>
798
- <div class="description">
799
- <p>
800
- Remove quotes from string.
801
- </p>
802
- <pre>
803
- &quot;'hi'&quot;.dequite #=&gt; &quot;hi&quot;
804
- </pre>
805
- <p>
806
- CREDIT: Trans
807
- </p>
808
- </div>
809
- <div class="sourcecode">
810
- <p class="source-link">[ <a href="javascript:toggleSource('M000322_source')" id="l_M000322_source">+</a> ]</p>
811
- <div id="M000322_source" class="dyn-source">
812
- <pre>
813
- <span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 88</span>
814
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dequote</span>
815
- <span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
816
-
817
- <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>]
818
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;'&quot;</span>, <span class="ruby-value str">'&quot;'</span>, <span class="ruby-value str">'`'</span>
819
- <span class="ruby-identifier">s</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">''</span>
820
- <span class="ruby-keyword kw">end</span>
821
-
822
- <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
823
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;'&quot;</span>, <span class="ruby-value str">'&quot;'</span>, <span class="ruby-value str">'`'</span>
824
- <span class="ruby-identifier">s</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span>
825
- <span class="ruby-keyword kw">end</span>
826
-
827
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
828
- <span class="ruby-keyword kw">end</span>
829
- </pre>
830
- </div>
831
- </div>
832
- </div>
833
- <div class="method">
834
- <div class="title">
835
- <a name="M000297"></a><b>divide</b>( re )
836
- </div>
837
- <div class="description">
838
- <p>
839
- Breaks a string up into an array based on a regular expression. Similar to
840
- scan, but includes the matches.
841
- </p>
842
- <pre>
843
- s = &quot;&lt;p&gt;This&lt;b&gt;is&lt;/b&gt;a test.&lt;/p&gt;&quot;
844
- s.divide( /\&lt;.*?\&gt;/ )
845
- </pre>
846
- <p>
847
- <em>produces</em>
848
- </p>
849
- <pre>
850
- [&quot;&lt;p&gt;This&quot;, &quot;&lt;b&gt;is&quot;, &quot;&lt;/b&gt;a test.&quot;, &quot;&lt;/p&gt;&quot;]
851
- </pre>
852
- <p>
853
- CREDIT: Trans
854
- </p>
855
- </div>
856
- <div class="sourcecode">
857
- <p class="source-link">[ <a href="javascript:toggleSource('M000297_source')" id="l_M000297_source">+</a> ]</p>
858
- <div id="M000297_source" class="dyn-source">
859
- <pre>
860
- <span class="ruby-comment cmt"># File lib/core/facets/string/divide.rb, line 15</span>
861
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">divide</span>( <span class="ruby-identifier">re</span> )
862
- <span class="ruby-identifier">re2</span> = <span class="ruby-node">/#{re}.*?(?=#{re}|\Z)/</span>
863
- <span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re2</span>) <span class="ruby-comment cmt">#{re}(?=#{re})/)</span>
864
- <span class="ruby-keyword kw">end</span>
865
- </pre>
866
- </div>
867
- </div>
868
- </div>
869
- <div class="method">
870
- <div class="title">
871
- <a name="M000301"></a><b>downcase?</b>()
872
- </div>
873
- <div class="description">
874
- <p>
875
- Return true if the string is lowercase (downcase), otherwise false.
876
- </p>
877
- <pre>
878
- &quot;THIS&quot;.downcase? #=&gt; false
879
- &quot;This&quot;.downcase? #=&gt; false
880
- &quot;this&quot;.downcase? #=&gt; true
881
- </pre>
882
- <p>
883
- CREDIT: Phil Tomson
884
- </p>
885
- </div>
886
- <div class="sourcecode">
887
- <p class="source-link">[ <a href="javascript:toggleSource('M000301_source')" id="l_M000301_source">+</a> ]</p>
888
- <div id="M000301_source" class="dyn-source">
889
- <pre>
890
- <span class="ruby-comment cmt"># File lib/core/facets/string/capitalized.rb, line 23</span>
891
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">downcase?</span>
892
- <span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
893
- <span class="ruby-keyword kw">end</span>
894
- </pre>
895
- </div>
896
- </div>
897
- </div>
898
- <div class="method">
899
- <div class="title">
900
- <a name="M000296"></a><b>each_char</b>() {|scanner.scan(char || break)| ...}
901
- </div>
902
- <div class="description">
903
- <p>
904
- Yields a single-character string for each character in the string. When
905
- $KCODE = &#8216;UTF8&#8217;, multi-byte characters are yielded
906
- appropriately.
907
- </p>
908
- </div>
909
- <div class="sourcecode">
910
- <p class="source-link">[ <a href="javascript:toggleSource('M000296_source')" id="l_M000296_source">+</a> ]</p>
911
- <div id="M000296_source" class="dyn-source">
912
- <pre>
913
- <span class="ruby-comment cmt"># File lib/core/facets/string/each_char.rb, line 22</span>
914
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_char</span>
915
- <span class="ruby-identifier">scanner</span>, <span class="ruby-identifier">char</span> = <span class="ruby-constant">StringScanner</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>), <span class="ruby-regexp re">/./</span><span class="ruby-identifier">mu</span>
916
- <span class="ruby-identifier">loop</span> { <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">char</span>) <span class="ruby-operator">||</span> <span class="ruby-keyword kw">break</span>) }
917
- <span class="ruby-keyword kw">end</span>
918
- </pre>
919
- </div>
920
- </div>
921
- </div>
922
- <div class="method">
923
- <div class="title">
924
- <a name="M000330"></a><b>each_word</b>(&amp;block)
925
- </div>
926
- <div class="description">
927
- <p>
928
- Iterate through each word of a string.
929
- </p>
930
- <pre>
931
- &quot;a string&quot;.each_word { |word, range| ... }
932
- </pre>
933
- </div>
934
- <div class="sourcecode">
935
- <p class="source-link">[ <a href="javascript:toggleSource('M000330_source')" id="l_M000330_source">+</a> ]</p>
936
- <div id="M000330_source" class="dyn-source">
937
- <pre>
938
- <span class="ruby-comment cmt"># File lib/core/facets/string/each_word.rb, line 9</span>
939
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_word</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
940
- <span class="ruby-identifier">words</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
941
- <span class="ruby-keyword kw">end</span>
942
- </pre>
943
- </div>
944
- </div>
945
- </div>
946
- <div class="method">
947
- <div class="title">
948
- <a name="M000277"></a><b>end_with?</b>(suffix)
949
- </div>
950
- <div class="description">
951
- <p>
952
- Does a string end with the given suffix?
953
- </p>
954
- <pre>
955
- &quot;hello&quot;.ends_with?(&quot;lo&quot;) #=&gt; true
956
- &quot;hello&quot;.ends_with?(&quot;to&quot;) #=&gt; false
957
- </pre>
958
- <p>
959
- CREDIT: Lucas Carlson, Blaine Cook
960
- </p>
961
- </div>
962
- <div class="sourcecode">
963
- <p class="source-link">[ <a href="javascript:toggleSource('M000277_source')" id="l_M000277_source">+</a> ]</p>
964
- <div id="M000277_source" class="dyn-source">
965
- <pre>
966
- <span class="ruby-comment cmt"># File lib/core/facets/string/start_with.rb, line 23</span>
967
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">end_with?</span>(<span class="ruby-identifier">suffix</span>)
968
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-identifier">suffix</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">suffix</span>.<span class="ruby-identifier">size</span>
969
- <span class="ruby-keyword kw">end</span>
970
- </pre>
971
- </div>
972
- </div>
973
- </div>
974
- <div class="method">
975
- <div class="title">
976
- <a name="M000303"></a><b>expand_tab</b>(n=8)
977
- </div>
978
- <div class="description">
979
- <p>
980
- Expands tabs to <tt>n</tt> spaces. Non-destructive. If <tt>n</tt> is 0,
981
- then tabs are simply removed. Raises an exception if <tt>n</tt> is
982
- negative.
983
- </p>
984
- <pre>
985
- &quot;\t\tHey&quot;.expand_tab(2) #=&gt; &quot; Hey&quot;
986
- </pre>
987
- <p>
988
- Thanks to GGaramuno for a more efficient algorithm. Very nice.
989
- </p>
990
- <p>
991
- CREDIT: Gavin Sinclair, Noah Gibbs, GGaramuno
992
- </p>
993
- </div>
994
- <div class="aka">
995
- This method is also aliased as
996
- <a href="String.html#M000304">expand_tabs</a>
997
- </div>
998
- <div class="sourcecode">
999
- <p class="source-link">[ <a href="javascript:toggleSource('M000303_source')" id="l_M000303_source">+</a> ]</p>
1000
- <div id="M000303_source" class="dyn-source">
1001
- <pre>
1002
- <span class="ruby-comment cmt"># File lib/core/facets/string/expand_tab.rb, line 13</span>
1003
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expand_tab</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">8</span>)
1004
- <span class="ruby-identifier">n</span> = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_int</span>
1005
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;n must be &gt;= 0&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>
1006
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\t/</span>, <span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
1007
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\t/</span>, <span class="ruby-value str">&quot; &quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
1008
- <span class="ruby-identifier">str</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
1009
- <span class="ruby-keyword kw">while</span>
1010
- <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^([^\t\n]*)(\t+)/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
1011
- <span class="ruby-identifier">val</span> = ( <span class="ruby-identifier">n</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">n</span>) )
1012
- <span class="ruby-identifier">$1</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">val</span>)
1013
- }
1014
- <span class="ruby-keyword kw">end</span>
1015
- <span class="ruby-identifier">str</span>
1016
- <span class="ruby-keyword kw">end</span>
1017
- </pre>
1018
- </div>
1019
- </div>
1020
- </div>
1021
- <div class="method">
1022
- <div class="title">
1023
- <a name="M000304"></a><b>expand_tabs</b>(n=8)
1024
- </div>
1025
- <div class="description">
1026
- <p>
1027
- Alias for <a href="String.html#M000303">expand_tab</a>
1028
- </p>
1029
- </div>
1030
- </div>
1031
- <div class="method">
1032
- <div class="title">
1033
- <a name="M000272"></a><b>file</b>()
1034
- </div>
1035
- <div class="description">
1036
- <p>
1037
- Use fluent notation for making <a href="String.html#M000272">file</a>
1038
- directives.
1039
- </p>
1040
- <pre>
1041
- '~/trans/Desktop/notes.txt'.file.mtime
1042
- </pre>
1043
- </div>
1044
- <div class="sourcecode">
1045
- <p class="source-link">[ <a href="javascript:toggleSource('M000272_source')" id="l_M000272_source">+</a> ]</p>
1046
- <div id="M000272_source" class="dyn-source">
1047
- <pre>
1048
- <span class="ruby-comment cmt"># File lib/core/facets/string/file.rb, line 9</span>
1049
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">file</span>
1050
- <span class="ruby-identifier">f</span> = <span class="ruby-keyword kw">self</span>
1051
- <span class="ruby-constant">Functor</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">op</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
1052
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">op</span>, <span class="ruby-identifier">f</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)
1053
- <span class="ruby-keyword kw">end</span>
1054
- <span class="ruby-keyword kw">end</span>
1055
- </pre>
1056
- </div>
1057
- </div>
1058
- </div>
1059
- <div class="method">
1060
- <div class="title">
1061
- <a name="M000275"></a><b>fold</b>(ignore_indented=false)
1062
- </div>
1063
- <div class="description">
1064
- <p>
1065
- Returns a new string with all new <a href="String.html#M000279">lines</a>
1066
- removed from adjacent <a href="String.html#M000279">lines</a> of text.
1067
- </p>
1068
- <pre>
1069
- s = &quot;This is\na test.\n\nIt clumps\nlines of text.&quot;
1070
- s.fold
1071
- </pre>
1072
- <p>
1073
- <em>produces</em>
1074
- </p>
1075
- <pre>
1076
- &quot;This is a test.\n\nIt clumps lines of text. &quot;
1077
- </pre>
1078
- <p>
1079
- One arguable flaw with this, that might need a fix: if the given string
1080
- ends in a newline, it is replaced with a single space.
1081
- </p>
1082
- <p>
1083
- CREDIT: Trans
1084
- </p>
1085
- </div>
1086
- <div class="sourcecode">
1087
- <p class="source-link">[ <a href="javascript:toggleSource('M000275_source')" id="l_M000275_source">+</a> ]</p>
1088
- <div id="M000275_source" class="dyn-source">
1089
- <pre>
1090
- <span class="ruby-comment cmt"># File lib/core/facets/string/fold.rb, line 19</span>
1091
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fold</span>(<span class="ruby-identifier">ignore_indented</span>=<span class="ruby-keyword kw">false</span>)
1092
- <span class="ruby-identifier">ns</span> = <span class="ruby-value str">''</span>
1093
- <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
1094
- <span class="ruby-identifier">br</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/(\n\s*\n|\Z)/</span><span class="ruby-identifier">m</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
1095
- <span class="ruby-identifier">b</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">1</span>)
1096
- <span class="ruby-identifier">e</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">1</span>)
1097
- <span class="ruby-identifier">nl</span> = <span class="ruby-identifier">$&amp;</span>
1098
- <span class="ruby-identifier">tx</span> = <span class="ruby-identifier">slice</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">...</span><span class="ruby-identifier">b</span>)
1099
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ignore_indented</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">slice</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">...</span><span class="ruby-identifier">b</span>) <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[ ]+/</span>
1100
- <span class="ruby-identifier">ns</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tx</span>
1101
- <span class="ruby-keyword kw">else</span>
1102
- <span class="ruby-identifier">ns</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tx</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[ ]*\n+/</span>,<span class="ruby-value str">' '</span>)
1103
- <span class="ruby-keyword kw">end</span>
1104
- <span class="ruby-identifier">ns</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">nl</span>
1105
- <span class="ruby-identifier">i</span> = <span class="ruby-identifier">e</span>
1106
- <span class="ruby-keyword kw">end</span>
1107
- <span class="ruby-identifier">ns</span>
1108
- <span class="ruby-keyword kw">end</span>
1109
- </pre>
1110
- </div>
1111
- </div>
1112
- </div>
1113
- <div class="method">
1114
- <div class="title">
1115
- <a name="M000309"></a><b>indent</b>(n)
1116
- </div>
1117
- <div class="description">
1118
- <p>
1119
- Indent left or right by n spaces. (This used to be called <a
1120
- href="String.html#M000287">tab</a> and aliased as <a
1121
- href="String.html#M000309">indent</a>.)
1122
- </p>
1123
- <p>
1124
- CREDIT: Gavin Sinclair, Trans
1125
- </p>
1126
- </div>
1127
- <div class="sourcecode">
1128
- <p class="source-link">[ <a href="javascript:toggleSource('M000309_source')" id="l_M000309_source">+</a> ]</p>
1129
- <div id="M000309_source" class="dyn-source">
1130
- <pre>
1131
- <span class="ruby-comment cmt"># File lib/core/facets/string/indent.rb, line 8</span>
1132
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">indent</span>(<span class="ruby-identifier">n</span>)
1133
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span>
1134
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^/</span>, <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
1135
- <span class="ruby-keyword kw">else</span>
1136
- <span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^ {0,#{-n}}/</span>, <span class="ruby-value str">&quot;&quot;</span>)
1137
- <span class="ruby-keyword kw">end</span>
1138
- <span class="ruby-keyword kw">end</span>
1139
- </pre>
1140
- </div>
1141
- </div>
1142
- </div>
1143
- <div class="method">
1144
- <div class="title">
1145
- <a name="M000294"></a><b>index_all</b>(s, reuse=false)
1146
- </div>
1147
- <div class="description">
1148
- <p>
1149
- Like index but returns an array of all index locations. The reuse flag
1150
- allows the trailing portion of a match to be reused for subsquent matches.
1151
- </p>
1152
- <pre>
1153
- &quot;abcabcabc&quot;.index_all('a') #=&gt; [0,3,6]
1154
-
1155
- &quot;bbb&quot;.index_all('bb', false) #=&gt; [0]
1156
- &quot;bbb&quot;.index_all('bb', true) #=&gt; [0,1]
1157
- </pre>
1158
- <p>
1159
- TODO: Culd probably be defined for <a href="Indexable.html">Indexable</a>
1160
- in general too.
1161
- </p>
1162
- </div>
1163
- <div class="sourcecode">
1164
- <p class="source-link">[ <a href="javascript:toggleSource('M000294_source')" id="l_M000294_source">+</a> ]</p>
1165
- <div id="M000294_source" class="dyn-source">
1166
- <pre>
1167
- <span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 66</span>
1168
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">index_all</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">reuse</span>=<span class="ruby-keyword kw">false</span>)
1169
- <span class="ruby-identifier">s</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">s</span>)) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Regexp</span><span class="ruby-operator">===</span><span class="ruby-identifier">s</span>
1170
- <span class="ruby-identifier">ia</span> = []; <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
1171
- <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">i</span> = <span class="ruby-identifier">index</span>(<span class="ruby-identifier">s</span>,<span class="ruby-identifier">i</span>))
1172
- <span class="ruby-identifier">ia</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">i</span>
1173
- <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">reuse</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$~</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">size</span>)
1174
- <span class="ruby-keyword kw">end</span>
1175
- <span class="ruby-identifier">ia</span>
1176
- <span class="ruby-keyword kw">end</span>
1177
- </pre>
1178
- </div>
1179
- </div>
1180
- </div>
1181
- <div class="method">
1182
- <div class="title">
1183
- <a name="M000324"></a><b>lchomp</b>(match)
1184
- </div>
1185
- <div class="description">
1186
- <p>
1187
- Left chomp.
1188
- </p>
1189
- <pre>
1190
- &quot;help&quot;.lchomp(&quot;h&quot;) #=&gt; &quot;elp&quot;
1191
- &quot;help&quot;.lchomp(&quot;k&quot;) #=&gt; &quot;help&quot;
1192
- </pre>
1193
- <p>
1194
- CREDIT: Trans
1195
- </p>
1196
- </div>
1197
- <div class="sourcecode">
1198
- <p class="source-link">[ <a href="javascript:toggleSource('M000324_source')" id="l_M000324_source">+</a> ]</p>
1199
- <div id="M000324_source" class="dyn-source">
1200
- <pre>
1201
- <span class="ruby-comment cmt"># File lib/core/facets/string/chomp.rb, line 10</span>
1202
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lchomp</span>(<span class="ruby-identifier">match</span>)
1203
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">match</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
1204
- <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">match</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
1205
- <span class="ruby-keyword kw">else</span>
1206
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
1207
- <span class="ruby-keyword kw">end</span>
1208
- <span class="ruby-keyword kw">end</span>
1209
- </pre>
1210
- </div>
1211
- </div>
1212
- </div>
1213
- <div class="method">
1214
- <div class="title">
1215
- <a name="M000325"></a><b>lchomp!</b>(match)
1216
- </div>
1217
- <div class="description">
1218
- <p>
1219
- In-place left chomp.
1220
- </p>
1221
- <pre>
1222
- &quot;help&quot;.lchomp(&quot;h&quot;) #=&gt; &quot;elp&quot;
1223
- &quot;help&quot;.lchomp(&quot;k&quot;) #=&gt; &quot;help&quot;
1224
- </pre>
1225
- <p>
1226
- CREDIT: Trans
1227
- </p>
1228
- </div>
1229
- <div class="sourcecode">
1230
- <p class="source-link">[ <a href="javascript:toggleSource('M000325_source')" id="l_M000325_source">+</a> ]</p>
1231
- <div id="M000325_source" class="dyn-source">
1232
- <pre>
1233
- <span class="ruby-comment cmt"># File lib/core/facets/string/chomp.rb, line 25</span>
1234
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lchomp!</span>(<span class="ruby-identifier">match</span>)
1235
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">match</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
1236
- <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">match</span>.<span class="ruby-identifier">size</span>] = <span class="ruby-value str">''</span>
1237
- <span class="ruby-keyword kw">self</span>
1238
- <span class="ruby-keyword kw">end</span>
1239
- <span class="ruby-keyword kw">end</span>
1240
- </pre>
1241
- </div>
1242
- </div>
1243
- </div>
1244
- <div class="method">
1245
- <div class="title">
1246
- <a name="M000316"></a><b>line_wrap</b>(width, tabs=4)
1247
- </div>
1248
- <div class="description">
1249
- <p>
1250
- Line wrap at width.
1251
- </p>
1252
- <pre>
1253
- puts &quot;1234567890&quot;.line_wrap(5)
1254
- </pre>
1255
- <p>
1256
- <em>produces</em>
1257
- </p>
1258
- <pre>
1259
- 12345
1260
- 67890
1261
- </pre>
1262
- <p>
1263
- CREDIT: Trans
1264
- </p>
1265
- </div>
1266
- <div class="sourcecode">
1267
- <p class="source-link">[ <a href="javascript:toggleSource('M000316_source')" id="l_M000316_source">+</a> ]</p>
1268
- <div id="M000316_source" class="dyn-source">
1269
- <pre>
1270
- <span class="ruby-comment cmt"># File lib/core/facets/string/line_wrap.rb, line 14</span>
1271
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">line_wrap</span>(<span class="ruby-identifier">width</span>, <span class="ruby-identifier">tabs</span>=<span class="ruby-value">4</span>)
1272
- <span class="ruby-identifier">s</span> = <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\t/</span>,<span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">tabs</span>) <span class="ruby-comment cmt"># tabs default to 4 spaces</span>
1273
- <span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n/</span>,<span class="ruby-value str">' '</span>)
1274
- <span class="ruby-identifier">r</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">scan</span>( <span class="ruby-node">/.{1,#{width}}/</span> )
1275
- <span class="ruby-identifier">r</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span>
1276
- <span class="ruby-keyword kw">end</span>
1277
- </pre>
1278
- </div>
1279
- </div>
1280
- </div>
1281
- <div class="method">
1282
- <div class="title">
1283
- <a name="M000279"></a><b>lines</b>()
1284
- </div>
1285
- <div class="description">
1286
- <p>
1287
- Returns an array of characters.
1288
- </p>
1289
- <pre>
1290
- &quot;abc\n123&quot;.lines #=&gt; [&quot;abc&quot;,&quot;123&quot;]
1291
- </pre>
1292
- </div>
1293
- <div class="sourcecode">
1294
- <p class="source-link">[ <a href="javascript:toggleSource('M000279_source')" id="l_M000279_source">+</a> ]</p>
1295
- <div id="M000279_source" class="dyn-source">
1296
- <pre>
1297
- <span class="ruby-comment cmt"># File lib/core/facets/string/lines.rb, line 9</span>
1298
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lines</span>
1299
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\n/</span>)
1300
- <span class="ruby-keyword kw">end</span>
1301
- </pre>
1302
- </div>
1303
- </div>
1304
- </div>
1305
- <div class="method">
1306
- <div class="title">
1307
- <a name="M000298"></a><b>margin</b>(n=0)
1308
- </div>
1309
- <div class="description">
1310
- <p>
1311
- Provides a <a href="String.html#M000298">margin</a> controlled string.
1312
- </p>
1313
- <pre>
1314
- x = %Q{
1315
- | This
1316
- | is
1317
- | margin controlled!
1318
- }.margin
1319
- </pre>
1320
- <p>
1321
- NOTE: This may still need a bit of tweaking.
1322
- </p>
1323
- <p>
1324
- CREDIT: Trans
1325
- </p>
1326
- </div>
1327
- <div class="sourcecode">
1328
- <p class="source-link">[ <a href="javascript:toggleSource('M000298_source')" id="l_M000298_source">+</a> ]</p>
1329
- <div id="M000298_source" class="dyn-source">
1330
- <pre>
1331
- <span class="ruby-comment cmt"># File lib/core/facets/string/margin.rb, line 16</span>
1332
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">margin</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">0</span>)
1333
- <span class="ruby-comment cmt">#d = /\A.*\n\s*(.)/.match( self )[1]</span>
1334
- <span class="ruby-comment cmt">#d = /\A\s*(.)/.match( self)[1] unless d</span>
1335
- <span class="ruby-identifier">d</span> = ((<span class="ruby-regexp re">/\A.*\n\s*(.)/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-keyword kw">self</span>)) <span class="ruby-operator">||</span>
1336
- (<span class="ruby-regexp re">/\A\s*(.)/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-keyword kw">self</span>)))[<span class="ruby-value">1</span>]
1337
- <span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">d</span>
1338
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
1339
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n\s*\Z/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^\s*[#{d}]/</span>, <span class="ruby-value str">''</span>)
1340
- <span class="ruby-keyword kw">else</span>
1341
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n\s*\Z/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^\s*[#{d}]/</span>, <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
1342
- <span class="ruby-keyword kw">end</span>
1343
- <span class="ruby-keyword kw">end</span>
1344
- </pre>
1345
- </div>
1346
- </div>
1347
- </div>
1348
- <div class="method">
1349
- <div class="title">
1350
- <a name="M000288"></a><b>methodize</b>()
1351
- </div>
1352
- <div class="description">
1353
- <p>
1354
- Translate a (class or module) name to a suitable method name.
1355
- </p>
1356
- <pre>
1357
- My::CoolClass.name.methodize =&gt; &quot;my__cool_class&quot;
1358
- </pre>
1359
- </div>
1360
- <div class="sourcecode">
1361
- <p class="source-link">[ <a href="javascript:toggleSource('M000288_source')" id="l_M000288_source">+</a> ]</p>
1362
- <div id="M000288_source" class="dyn-source">
1363
- <pre>
1364
- <span class="ruby-comment cmt"># File lib/core/facets/string/methodize.rb, line 7</span>
1365
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">methodize</span>
1366
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
1367
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
1368
- <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'/'</span> ,<span class="ruby-value str">'__'</span>).
1369
- <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'::'</span>,<span class="ruby-value str">'__'</span>).
1370
- <span class="ruby-identifier">downcase</span>
1371
- <span class="ruby-keyword kw">end</span>
1372
- </pre>
1373
- </div>
1374
- </div>
1375
- </div>
1376
- <div class="method">
1377
- <div class="title">
1378
- <a name="M000280"></a><b>modulize</b>()
1379
- </div>
1380
- <div class="description">
1381
- <p>
1382
- Converts a string to module name representation.
1383
- </p>
1384
- <p>
1385
- This is essentially <a href="String.html#M000278">camelcase</a>. It also
1386
- converts &#8217;/&#8217; to &#8217;::&#8217; which is useful for converting
1387
- paths to namespaces.
1388
- </p>
1389
- <p>
1390
- Examples
1391
- </p>
1392
- <pre>
1393
- &quot;method_name&quot;.modulize #=&gt; &quot;MethodName&quot;
1394
- &quot;method/name&quot;.modulize #=&gt; &quot;Method::Name&quot;
1395
- </pre>
1396
- </div>
1397
- <div class="sourcecode">
1398
- <p class="source-link">[ <a href="javascript:toggleSource('M000280_source')" id="l_M000280_source">+</a> ]</p>
1399
- <div id="M000280_source" class="dyn-source">
1400
- <pre>
1401
- <span class="ruby-comment cmt"># File lib/core/facets/string/modulize.rb, line 13</span>
1402
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">modulize</span>
1403
- <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'__'</span>,<span class="ruby-value str">'/'</span>).
1404
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\/(.?)/</span>){ <span class="ruby-node">&quot;::#{$1.upcase}&quot;</span> }.
1405
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(?:_+|-+)([a-z])/</span>){ <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }.
1406
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(\A|\s)([a-z])/</span>){ <span class="ruby-identifier">$1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
1407
- <span class="ruby-keyword kw">end</span>
1408
- </pre>
1409
- </div>
1410
- </div>
1411
- </div>
1412
- <div class="method">
1413
- <div class="title">
1414
- <a name="M000299"></a><b>mscan</b>(re) {|| ...}
1415
- </div>
1416
- <div class="description">
1417
- <p>
1418
- Like scan but returns <a href="MatchData.html">MatchData</a> ($~) rather
1419
- then matched string ($&amp;).
1420
- </p>
1421
- <p>
1422
- CREDIT: Trans
1423
- </p>
1424
- </div>
1425
- <div class="sourcecode">
1426
- <p class="source-link">[ <a href="javascript:toggleSource('M000299_source')" id="l_M000299_source">+</a> ]</p>
1427
- <div id="M000299_source" class="dyn-source">
1428
- <pre>
1429
- <span class="ruby-comment cmt"># File lib/core/facets/string/mscan.rb, line 8</span>
1430
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mscan</span>(<span class="ruby-identifier">re</span>) <span class="ruby-comment cmt">#:yield:</span>
1431
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
1432
- <span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re</span>) { <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">$~</span>) }
1433
- <span class="ruby-keyword kw">else</span>
1434
- <span class="ruby-identifier">m</span> = []
1435
- <span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re</span>) { <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">$~</span> }
1436
- <span class="ruby-identifier">m</span>
1437
- <span class="ruby-keyword kw">end</span>
1438
- <span class="ruby-keyword kw">end</span>
1439
- </pre>
1440
- </div>
1441
- </div>
1442
- </div>
1443
- <div class="method">
1444
- <div class="title">
1445
- <a name="M000305"></a><b>natcmp</b>(str2, caseInsensitive=false)
1446
- </div>
1447
- <div class="description">
1448
- <p>
1449
- &#8216;Natural order&#8217; comparison of strings, e.g.
1450
- </p>
1451
- <pre>
1452
- &quot;my_prog_v1.1.0&quot; &lt; &quot;my_prog_v1.2.0&quot; &lt; &quot;my_prog_v1.10.0&quot;
1453
- </pre>
1454
- <p>
1455
- which does not follow alphabetically. A secondary parameter, if set to
1456
- <em>true</em>, makes the comparison case insensitive.
1457
- </p>
1458
- <pre>
1459
- &quot;Hello.10&quot;.natcmp(&quot;Hello.1&quot;) #=&gt; -1
1460
-
1461
- TODO: Invert case flag?
1462
- </pre>
1463
- <p>
1464
- CREDIT: Alan Davies, Martin Pool
1465
- </p>
1466
- </div>
1467
- <div class="sourcecode">
1468
- <p class="source-link">[ <a href="javascript:toggleSource('M000305_source')" id="l_M000305_source">+</a> ]</p>
1469
- <div id="M000305_source" class="dyn-source">
1470
- <pre>
1471
- <span class="ruby-comment cmt"># File lib/core/facets/string/natcmp.rb, line 46</span>
1472
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">natcmp</span>(<span class="ruby-identifier">str2</span>, <span class="ruby-identifier">caseInsensitive</span>=<span class="ruby-keyword kw">false</span>)
1473
- <span class="ruby-identifier">str1</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
1474
- <span class="ruby-identifier">str2</span> = <span class="ruby-identifier">str2</span>.<span class="ruby-identifier">dup</span>
1475
- <span class="ruby-identifier">compareExpression</span> = <span class="ruby-regexp re">/^(\D*)(\d*)(.*)$/</span>
1476
-
1477
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">caseInsensitive</span>
1478
- <span class="ruby-identifier">str1</span>.<span class="ruby-identifier">downcase!</span>
1479
- <span class="ruby-identifier">str2</span>.<span class="ruby-identifier">downcase!</span>
1480
- <span class="ruby-keyword kw">end</span>
1481
-
1482
- <span class="ruby-comment cmt"># remove all whitespace</span>
1483
- <span class="ruby-identifier">str1</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\s*/</span>, <span class="ruby-value str">''</span>)
1484
- <span class="ruby-identifier">str2</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\s*/</span>, <span class="ruby-value str">''</span>)
1485
-
1486
- <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">str1</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">str2</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">do</span>
1487
- <span class="ruby-comment cmt"># Extract non-digits, digits and rest of string</span>
1488
- <span class="ruby-identifier">str1</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">compareExpression</span>
1489
- <span class="ruby-identifier">chars1</span>, <span class="ruby-identifier">num1</span>, <span class="ruby-identifier">str1</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">dup</span>
1490
- <span class="ruby-identifier">str2</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">compareExpression</span>
1491
- <span class="ruby-identifier">chars2</span>, <span class="ruby-identifier">num2</span>, <span class="ruby-identifier">str2</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">dup</span>
1492
- <span class="ruby-comment cmt"># Compare the non-digits</span>
1493
- <span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">chars1</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">chars2</span>)
1494
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span> <span class="ruby-comment cmt"># Non-digits are the same, compare the digits...</span>
1495
- <span class="ruby-comment cmt"># If either number begins with a zero, then compare alphabetically,</span>
1496
- <span class="ruby-comment cmt"># otherwise compare numerically</span>
1497
- <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">num1</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">48</span>) <span class="ruby-keyword kw">and</span> (<span class="ruby-identifier">num2</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">48</span>)
1498
- <span class="ruby-identifier">num1</span>, <span class="ruby-identifier">num2</span> = <span class="ruby-identifier">num1</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">num2</span>.<span class="ruby-identifier">to_i</span>
1499
- <span class="ruby-keyword kw">end</span>
1500
- <span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">num1</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">num2</span>)
1501
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">-1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
1502
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
1503
- <span class="ruby-keyword kw">end</span>
1504
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">-1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
1505
- <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
1506
- <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># case</span>
1507
- <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># while</span>
1508
-
1509
- <span class="ruby-comment cmt"># strings are naturally equal.</span>
1510
- <span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
1511
- <span class="ruby-keyword kw">end</span>
1512
-
1513
- <span class="ruby-keyword kw">end</span>
1514
- </pre>
1515
- </div>
1516
- </div>
1517
- </div>
1518
- <div class="method">
1519
- <div class="title">
1520
- <a name="M000328"></a><b>nchar</b>(n, replacement=nil)
1521
- </div>
1522
- <div class="description">
1523
- <p>
1524
- Returns <em>n</em> characters of the string. If <em>n</em> is positive the
1525
- characters are from the beginning of the string. If <em>n</em> is negative
1526
- from the end of the string.
1527
- </p>
1528
- <p>
1529
- Alternatively a replacement string can be given, which will replace the
1530
- <em>n</em> characters.
1531
- </p>
1532
- <pre>
1533
- str = &quot;this is text&quot;
1534
- str.nchar(4) #=&gt; &quot;this&quot;
1535
- str.nchar(4, 'that') #=&gt; &quot;that&quot;
1536
- str #=&gt; &quot;that is text&quot;
1537
- </pre>
1538
- </div>
1539
- <div class="sourcecode">
1540
- <p class="source-link">[ <a href="javascript:toggleSource('M000328_source')" id="l_M000328_source">+</a> ]</p>
1541
- <div id="M000328_source" class="dyn-source">
1542
- <pre>
1543
- <span class="ruby-comment cmt"># File lib/core/facets/string/nchar.rb, line 15</span>
1544
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nchar</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">replacement</span>=<span class="ruby-keyword kw">nil</span>)
1545
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replacement</span>
1546
- <span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
1547
- <span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> (<span class="ruby-identifier">s</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>] = <span class="ruby-identifier">replacement</span>) <span class="ruby-operator">:</span> (<span class="ruby-identifier">s</span>[<span class="ruby-identifier">n</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] = <span class="ruby-identifier">replacement</span>)
1548
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
1549
- <span class="ruby-keyword kw">else</span>
1550
- <span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">n</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
1551
- <span class="ruby-keyword kw">end</span>
1552
- <span class="ruby-keyword kw">end</span>
1553
- </pre>
1554
- </div>
1555
- </div>
1556
- </div>
1557
- <div class="method">
1558
- <div class="title">
1559
- <a name="M000310"></a><b>outdent</b>(n)
1560
- </div>
1561
- <div class="description">
1562
- <p>
1563
- Outdent just indents a negative number of spaces.
1564
- </p>
1565
- <p>
1566
- CREDIT: Noah Gibbs
1567
- </p>
1568
- </div>
1569
- <div class="sourcecode">
1570
- <p class="source-link">[ <a href="javascript:toggleSource('M000310_source')" id="l_M000310_source">+</a> ]</p>
1571
- <div id="M000310_source" class="dyn-source">
1572
- <pre>
1573
- <span class="ruby-comment cmt"># File lib/core/facets/string/indent.rb, line 20</span>
1574
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">outdent</span>(<span class="ruby-identifier">n</span>)
1575
- <span class="ruby-identifier">indent</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">n</span>)
1576
- <span class="ruby-keyword kw">end</span>
1577
- </pre>
1578
- </div>
1579
- </div>
1580
- </div>
1581
- <div class="method">
1582
- <div class="title">
1583
- <a name="M000308"></a><b>pathize</b>()
1584
- </div>
1585
- <div class="description">
1586
- <p>
1587
- Converts a (class or module) name to a unix path.
1588
- </p>
1589
- <pre>
1590
- My::CoolClass.name.pathize #=&gt; &quot;my/cool_class&quot;
1591
- </pre>
1592
- </div>
1593
- <div class="sourcecode">
1594
- <p class="source-link">[ <a href="javascript:toggleSource('M000308_source')" id="l_M000308_source">+</a> ]</p>
1595
- <div id="M000308_source" class="dyn-source">
1596
- <pre>
1597
- <span class="ruby-comment cmt"># File lib/core/facets/string/pathize.rb, line 7</span>
1598
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pathize</span>
1599
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
1600
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
1601
- <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'__'</span>,<span class="ruby-value str">'/'</span>).
1602
- <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'::'</span>,<span class="ruby-value str">'/'</span>).
1603
- <span class="ruby-identifier">downcase</span>
1604
- <span class="ruby-keyword kw">end</span>
1605
- </pre>
1606
- </div>
1607
- </div>
1608
- </div>
1609
- <div class="method">
1610
- <div class="title">
1611
- <a name="M000321"></a><b>quote</b>(type=:s)
1612
- </div>
1613
- <div class="description">
1614
- <p>
1615
- Return a new string embraced by given quotes. If no quotes are specified,
1616
- then assumes single quotes.
1617
- </p>
1618
- <pre>
1619
- &quot;quote me&quot;.quote #=&gt; &quot;'quote me'&quot;
1620
- &quot;quote me&quot;.quote(2) #=&gt; &quot;\&quot;quote me\&quot;&quot;
1621
- </pre>
1622
- <p>
1623
- CREDIT: Trans
1624
- </p>
1625
- </div>
1626
- <div class="sourcecode">
1627
- <p class="source-link">[ <a href="javascript:toggleSource('M000321_source')" id="l_M000321_source">+</a> ]</p>
1628
- <div id="M000321_source" class="dyn-source">
1629
- <pre>
1630
- <span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 69</span>
1631
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quote</span>(<span class="ruby-identifier">type</span>=<span class="ruby-identifier">:s</span>)
1632
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>
1633
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'s'</span>, <span class="ruby-value str">'single'</span>
1634
- <span class="ruby-identifier">bracket</span>(<span class="ruby-value str">&quot;'&quot;</span>)
1635
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'double'</span>
1636
- <span class="ruby-identifier">bracket</span>(<span class="ruby-value str">'&quot;'</span>)
1637
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'back'</span>
1638
- <span class="ruby-identifier">bracket</span>(<span class="ruby-value str">'`'</span>)
1639
- <span class="ruby-keyword kw">else</span>
1640
- <span class="ruby-identifier">bracket</span>(<span class="ruby-value str">&quot;'&quot;</span>)
1641
- <span class="ruby-keyword kw">end</span>
1642
- <span class="ruby-keyword kw">end</span>
1643
- </pre>
1644
- </div>
1645
- </div>
1646
- </div>
1647
- <div class="method">
1648
- <div class="title">
1649
- <a name="M000291"></a><b>range</b>(s, offset=0)
1650
- </div>
1651
- <div class="description">
1652
- <p>
1653
- Like index but returns a <a href="Range.html">Range</a>.
1654
- </p>
1655
- <pre>
1656
- &quot;This is a test!&quot;.range('test') #=&gt; 10..13
1657
- </pre>
1658
- <p>
1659
- CREDIT: Trans
1660
- </p>
1661
- </div>
1662
- <div class="sourcecode">
1663
- <p class="source-link">[ <a href="javascript:toggleSource('M000291_source')" id="l_M000291_source">+</a> ]</p>
1664
- <div id="M000291_source" class="dyn-source">
1665
- <pre>
1666
- <span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 9</span>
1667
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">offset</span>=<span class="ruby-value">0</span>)
1668
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">offset</span>)
1669
- <span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">$~</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>))<span class="ruby-operator">..</span>(<span class="ruby-identifier">$~</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)<span class="ruby-operator">-</span><span class="ruby-value">1</span>)
1670
- <span class="ruby-keyword kw">end</span>
1671
- <span class="ruby-keyword kw">nil</span>
1672
- <span class="ruby-keyword kw">end</span>
1673
- </pre>
1674
- </div>
1675
- </div>
1676
- </div>
1677
- <div class="method">
1678
- <div class="title">
1679
- <a name="M000292"></a><b>range_all</b>(s, reuse=false)
1680
- </div>
1681
- <div class="description">
1682
- <p>
1683
- Like <a href="String.html#M000294">index_all</a> but returns an array of
1684
- Ranges.
1685
- </p>
1686
- <pre>
1687
- &quot;abc123abc123&quot;.range_all('abc') #=&gt; [0..2, 6..8]
1688
-
1689
- TODO: Add offset, perhaps ?
1690
- </pre>
1691
- <p>
1692
- CREDIT: Trans
1693
- </p>
1694
- </div>
1695
- <div class="sourcecode">
1696
- <p class="source-link">[ <a href="javascript:toggleSource('M000292_source')" id="l_M000292_source">+</a> ]</p>
1697
- <div id="M000292_source" class="dyn-source">
1698
- <pre>
1699
- <span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 24</span>
1700
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range_all</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">reuse</span>=<span class="ruby-keyword kw">false</span>)
1701
- <span class="ruby-identifier">r</span> = []; <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
1702
- <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>
1703
- <span class="ruby-identifier">rng</span> = <span class="ruby-identifier">range</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">i</span>)
1704
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rng</span>
1705
- <span class="ruby-identifier">r</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">rng</span>
1706
- <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">reuse</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">rng</span>.<span class="ruby-identifier">end</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
1707
- <span class="ruby-keyword kw">else</span>
1708
- <span class="ruby-keyword kw">break</span>
1709
- <span class="ruby-keyword kw">end</span>
1710
- <span class="ruby-keyword kw">end</span>
1711
- <span class="ruby-identifier">r</span>.<span class="ruby-identifier">uniq</span>
1712
- <span class="ruby-keyword kw">end</span>
1713
- </pre>
1714
- </div>
1715
- </div>
1716
- </div>
1717
- <div class="method">
1718
- <div class="title">
1719
- <a name="M000293"></a><b>range_of_line</b>()
1720
- </div>
1721
- <div class="description">
1722
- <p>
1723
- Returns an array of ranges mapping the characters per line.
1724
- </p>
1725
- <pre>
1726
- &quot;this\nis\na\ntest&quot;.range_of_line
1727
- #=&gt; [0..4, 5..7, 8..9, 10..13]
1728
- </pre>
1729
- <p>
1730
- CREDIT: Trans
1731
- </p>
1732
- </div>
1733
- <div class="sourcecode">
1734
- <p class="source-link">[ <a href="javascript:toggleSource('M000293_source')" id="l_M000293_source">+</a> ]</p>
1735
- <div id="M000293_source" class="dyn-source">
1736
- <pre>
1737
- <span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 46</span>
1738
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range_of_line</span>
1739
- <span class="ruby-identifier">offset</span>=<span class="ruby-value">0</span>; <span class="ruby-identifier">charmap</span> = []
1740
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
1741
- <span class="ruby-identifier">charmap</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">offset</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">offset</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>))
1742
- <span class="ruby-identifier">offset</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">length</span>
1743
- <span class="ruby-keyword kw">end</span>
1744
- <span class="ruby-identifier">charmap</span>
1745
- <span class="ruby-keyword kw">end</span>
1746
- </pre>
1747
- </div>
1748
- </div>
1749
- </div>
1750
- <div class="method">
1751
- <div class="title">
1752
- <a name="M000327"></a><b>rewrite</b>(rules)
1753
- </div>
1754
- <div class="description">
1755
- <p>
1756
- Apply a set of rules (regular expression matches) to the string.
1757
- </p>
1758
- <h3>Requirements:</h3>
1759
- <p>
1760
- The rules must be applied in order! So we cannot use a hash because the
1761
- ordering is not guaranteed! we use an array instead.
1762
- </p>
1763
- <h3>Input:</h3>
1764
- <p>
1765
- The array containing rule-pairs (match, write).
1766
- </p>
1767
- <h3>Output:</h3>
1768
- <p>
1769
- The rewritten string.
1770
- </p>
1771
- <p>
1772
- CREDIT: George Moschovitis
1773
- </p>
1774
- </div>
1775
- <div class="sourcecode">
1776
- <p class="source-link">[ <a href="javascript:toggleSource('M000327_source')" id="l_M000327_source">+</a> ]</p>
1777
- <div id="M000327_source" class="dyn-source">
1778
- <pre>
1779
- <span class="ruby-comment cmt"># File lib/core/facets/string/rewrite.rb, line 18</span>
1780
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rewrite</span>(<span class="ruby-identifier">rules</span>)
1781
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'The rules parameter is nil'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">rules</span>
1782
- <span class="ruby-identifier">rewritten_string</span> = <span class="ruby-identifier">dup</span>
1783
- <span class="ruby-identifier">rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span>,<span class="ruby-identifier">write</span><span class="ruby-operator">|</span>
1784
- <span class="ruby-identifier">rewritten_string</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">match</span>,<span class="ruby-identifier">write</span>)
1785
- <span class="ruby-keyword kw">end</span>
1786
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rewritten_string</span>
1787
- <span class="ruby-keyword kw">end</span>
1788
- </pre>
1789
- </div>
1790
- </div>
1791
- </div>
1792
- <div class="method">
1793
- <div class="title">
1794
- <a name="M000271"></a><b>shatter</b>( re )
1795
- </div>
1796
- <div class="description">
1797
- <p>
1798
- Breaks a string up into an array based on a regular expression. Similar to
1799
- scan, but includes the matches.
1800
- </p>
1801
- <pre>
1802
- s = &quot;&lt;p&gt;This&lt;b&gt;is&lt;/b&gt;a test.&lt;/p&gt;&quot;
1803
- s.shatter( /\&lt;.*?\&gt;/ )
1804
- </pre>
1805
- <p>
1806
- <em>produces</em>
1807
- </p>
1808
- <pre>
1809
- [&quot;&lt;p&gt;&quot;, &quot;This&quot;, &quot;&lt;b&gt;&quot;, &quot;is&quot;, &quot;&lt;/b&gt;&quot;, &quot;a test.&quot;, &quot;&lt;/p&gt;&quot;]
1810
- </pre>
1811
- <p>
1812
- CREDIT: Trans
1813
- </p>
1814
- </div>
1815
- <div class="sourcecode">
1816
- <p class="source-link">[ <a href="javascript:toggleSource('M000271_source')" id="l_M000271_source">+</a> ]</p>
1817
- <div id="M000271_source" class="dyn-source">
1818
- <pre>
1819
- <span class="ruby-comment cmt"># File lib/core/facets/string/shatter.rb, line 15</span>
1820
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shatter</span>( <span class="ruby-identifier">re</span> )
1821
- <span class="ruby-identifier">r</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-identifier">re</span> ){ <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-value str">&quot;\1&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;\1&quot;</span> }
1822
- <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">r</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;\1&quot;</span> ; <span class="ruby-identifier">r</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">''</span> ; <span class="ruby-keyword kw">end</span>
1823
- <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">r</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;\1&quot;</span> ; <span class="ruby-identifier">r</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span> ; <span class="ruby-keyword kw">end</span>
1824
- <span class="ruby-identifier">r</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;\1&quot;</span>)
1825
- <span class="ruby-keyword kw">end</span>
1826
- </pre>
1827
- </div>
1828
- </div>
1829
- </div>
1830
- <div class="method">
1831
- <div class="title">
1832
- <a name="M000295"></a><b>snakecase</b>()
1833
- </div>
1834
- <div class="description">
1835
- <p>
1836
- The reverse of <tt><a href="String.html#M000278">camelcase</a></tt>. Makes
1837
- an underscored of a <a href="String.html#M000278">camelcase</a> string.
1838
- </p>
1839
- <p>
1840
- Changes &#8217;::&#8217; to &#8217;/&#8217; to convert namespaces to paths.
1841
- </p>
1842
- <p>
1843
- Examples
1844
- </p>
1845
- <pre>
1846
- &quot;SnakeCase&quot;.snakecase #=&gt; &quot;snake_case&quot;
1847
- &quot;Snake-Case&quot;.snakecase #=&gt; &quot;snake_case&quot;
1848
- &quot;SnakeCase::Errors&quot;.underscore #=&gt; &quot;snake_case/errors&quot;
1849
- </pre>
1850
- </div>
1851
- <div class="sourcecode">
1852
- <p class="source-link">[ <a href="javascript:toggleSource('M000295_source')" id="l_M000295_source">+</a> ]</p>
1853
- <div id="M000295_source" class="dyn-source">
1854
- <pre>
1855
- <span class="ruby-comment cmt"># File lib/core/facets/string/snakecase.rb, line 12</span>
1856
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snakecase</span>
1857
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/::/</span>, <span class="ruby-value str">'/'</span>). <span class="ruby-comment cmt"># NOT SO SURE ABOUT THIS -T</span>
1858
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z][a-z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
1859
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z\d])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
1860
- <span class="ruby-identifier">tr</span>(<span class="ruby-value str">&quot;-&quot;</span>, <span class="ruby-value str">&quot;_&quot;</span>).
1861
- <span class="ruby-identifier">downcase</span>
1862
- <span class="ruby-keyword kw">end</span>
1863
- </pre>
1864
- </div>
1865
- </div>
1866
- </div>
1867
- <div class="method">
1868
- <div class="title">
1869
- <a name="M000326"></a><b>splice</b>(idx, sub=nil)
1870
- </div>
1871
- <div class="description">
1872
- <p>
1873
- This is basically the same as store, but it acts like slice! when given
1874
- only one argument.
1875
- </p>
1876
- <p>
1877
- Essentlay slice, but writes rather than reads.
1878
- </p>
1879
- <pre>
1880
- a = &quot;HELLO&quot;
1881
- a.splice(&quot;X&quot;, 1)
1882
- a #=&gt; &quot;HXLLO&quot;
1883
-
1884
- a = &quot;HELLO&quot;
1885
- a.splice(1) #=&gt; &quot;E&quot;
1886
- a #=&gt; &quot;HLLO&quot;
1887
- </pre>
1888
- <p>
1889
- CREDIT: Trans
1890
- </p>
1891
- </div>
1892
- <div class="sourcecode">
1893
- <p class="source-link">[ <a href="javascript:toggleSource('M000326_source')" id="l_M000326_source">+</a> ]</p>
1894
- <div id="M000326_source" class="dyn-source">
1895
- <pre>
1896
- <span class="ruby-comment cmt"># File lib/core/facets/string/splice.rb, line 20</span>
1897
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">splice</span>(<span class="ruby-identifier">idx</span>, <span class="ruby-identifier">sub</span>=<span class="ruby-keyword kw">nil</span>)
1898
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sub</span>
1899
- <span class="ruby-identifier">store</span>(<span class="ruby-identifier">idx</span>, <span class="ruby-identifier">sub</span>)
1900
- <span class="ruby-keyword kw">else</span>
1901
- <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">idx</span>
1902
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Range</span>
1903
- <span class="ruby-identifier">slice!</span>(<span class="ruby-identifier">idx</span>)
1904
- <span class="ruby-keyword kw">else</span>
1905
- <span class="ruby-identifier">slice!</span>(<span class="ruby-identifier">idx</span>,<span class="ruby-value">1</span>)
1906
- <span class="ruby-keyword kw">end</span>
1907
- <span class="ruby-keyword kw">end</span>
1908
- <span class="ruby-keyword kw">end</span>
1909
- </pre>
1910
- </div>
1911
- </div>
1912
- </div>
1913
- <div class="method">
1914
- <div class="title">
1915
- <a name="M000276"></a><b>start_with?</b>(prefix)
1916
- </div>
1917
- <div class="description">
1918
- <p>
1919
- Does a string start with the given prefix.
1920
- </p>
1921
- <pre>
1922
- &quot;hello&quot;.starts_with?(&quot;he&quot;) #=&gt; true
1923
- &quot;hello&quot;.starts_with?(&quot;to&quot;) #=&gt; false
1924
- </pre>
1925
- <p>
1926
- CREDIT: Lucas Carlson, Blaine Cook
1927
- </p>
1928
- </div>
1929
- <div class="sourcecode">
1930
- <p class="source-link">[ <a href="javascript:toggleSource('M000276_source')" id="l_M000276_source">+</a> ]</p>
1931
- <div id="M000276_source" class="dyn-source">
1932
- <pre>
1933
- <span class="ruby-comment cmt"># File lib/core/facets/string/start_with.rb, line 12</span>
1934
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_with?</span>(<span class="ruby-identifier">prefix</span>)
1935
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">prefix</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
1936
- <span class="ruby-keyword kw">end</span>
1937
- </pre>
1938
- </div>
1939
- </div>
1940
- </div>
1941
- <div class="method">
1942
- <div class="title">
1943
- <a name="M000287"></a><b>tab</b>(n)
1944
- </div>
1945
- <div class="description">
1946
- <p>
1947
- Aligns each line n spaces.
1948
- </p>
1949
- <p>
1950
- CREDIT: Gavin Sinclair
1951
- </p>
1952
- </div>
1953
- <div class="sourcecode">
1954
- <p class="source-link">[ <a href="javascript:toggleSource('M000287_source')" id="l_M000287_source">+</a> ]</p>
1955
- <div id="M000287_source" class="dyn-source">
1956
- <pre>
1957
- <span class="ruby-comment cmt"># File lib/core/facets/string/tab.rb, line 12</span>
1958
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tab</span>(<span class="ruby-identifier">n</span>)
1959
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^ */</span>, <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
1960
- <span class="ruby-keyword kw">end</span>
1961
- </pre>
1962
- </div>
1963
- </div>
1964
- </div>
1965
- <div class="method">
1966
- <div class="title">
1967
- <a name="M000312"></a><b>tabto</b>(n)
1968
- </div>
1969
- <div class="description">
1970
- <p>
1971
- Preserves relative tabbing. The first non-empty line ends up with n spaces
1972
- before nonspace.
1973
- </p>
1974
- <p>
1975
- CREDIT: Gavin Sinclair
1976
- </p>
1977
- </div>
1978
- <div class="sourcecode">
1979
- <p class="source-link">[ <a href="javascript:toggleSource('M000312_source')" id="l_M000312_source">+</a> ]</p>
1980
- <div id="M000312_source" class="dyn-source">
1981
- <pre>
1982
- <span class="ruby-comment cmt"># File lib/core/facets/string/tabto.rb, line 10</span>
1983
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabto</span>(<span class="ruby-identifier">n</span>)
1984
- <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^( *)\S/</span>
1985
- <span class="ruby-identifier">indent</span>(<span class="ruby-identifier">n</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">length</span>)
1986
- <span class="ruby-keyword kw">else</span>
1987
- <span class="ruby-keyword kw">self</span>
1988
- <span class="ruby-keyword kw">end</span>
1989
- <span class="ruby-keyword kw">end</span>
1990
- </pre>
1991
- </div>
1992
- </div>
1993
- </div>
1994
- <div class="method">
1995
- <div class="title">
1996
- <a name="M000311"></a><b>titlecase</b>()
1997
- </div>
1998
- <div class="description">
1999
- <p>
2000
- Title case.
2001
- </p>
2002
- <pre>
2003
- &quot;this is a string&quot;.titlecase
2004
- =&gt; &quot;This Is A String&quot;
2005
- </pre>
2006
- <p>
2007
- CREDIT: Eliazar Parra
2008
- </p>
2009
- </div>
2010
- <div class="sourcecode">
2011
- <p class="source-link">[ <a href="javascript:toggleSource('M000311_source')" id="l_M000311_source">+</a> ]</p>
2012
- <div id="M000311_source" class="dyn-source">
2013
- <pre>
2014
- <span class="ruby-comment cmt"># File lib/core/facets/string/titlecase.rb, line 10</span>
2015
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">titlecase</span>
2016
- <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\b\w/</span>){<span class="ruby-identifier">$&amp;</span>.<span class="ruby-identifier">upcase</span>}
2017
- <span class="ruby-keyword kw">end</span>
2018
- </pre>
2019
- </div>
2020
- </div>
2021
- </div>
2022
- <div class="method">
2023
- <div class="title">
2024
- <a name="M000269"></a><b>to_b</b>()
2025
- </div>
2026
- <div class="description">
2027
- <p>
2028
- Interpret common affirmative string meanings as true, otherwise false.
2029
- Balnk sapce and case are ignored. The following strings that will return
2030
- true:
2031
- </p>
2032
- <pre>
2033
- &lt;tt&gt;true&lt;/tt&gt;,&lt;tt&gt;yes&lt;/tt&gt;,&lt;tt&gt;on&lt;/tt&gt;,&lt;tt&gt;t&lt;/tt&gt;,&lt;tt&gt;1&lt;/tt&gt;,&lt;tt&gt;y&lt;/tt&gt;,&lt;tt&gt;==&lt;/tt&gt;
2034
- </pre>
2035
- <p>
2036
- Examples:
2037
- </p>
2038
- <pre>
2039
- &quot;true&quot;.to_b #=&gt; true
2040
- &quot;yes&quot;.to_b #=&gt; true
2041
- &quot;no&quot;.to_b #=&gt; false
2042
- &quot;123&quot;.to_b #=&gt; false
2043
- </pre>
2044
- </div>
2045
- <div class="sourcecode">
2046
- <p class="source-link">[ <a href="javascript:toggleSource('M000269_source')" id="l_M000269_source">+</a> ]</p>
2047
- <div id="M000269_source" class="dyn-source">
2048
- <pre>
2049
- <span class="ruby-comment cmt"># File lib/core/facets/boolean.rb, line 43</span>
2050
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_b</span>
2051
- <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">strip</span>
2052
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'true'</span>, <span class="ruby-value str">'yes'</span>, <span class="ruby-value str">'on'</span>, <span class="ruby-value str">'t'</span>, <span class="ruby-value str">'1'</span>, <span class="ruby-value str">'y'</span>, <span class="ruby-value str">'=='</span>
2053
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
2054
- <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'nil'</span>, <span class="ruby-value str">'null'</span>
2055
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
2056
- <span class="ruby-keyword kw">else</span>
2057
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
2058
- <span class="ruby-keyword kw">end</span>
2059
- <span class="ruby-keyword kw">end</span>
2060
- </pre>
2061
- </div>
2062
- </div>
2063
- </div>
2064
- <div class="method">
2065
- <div class="title">
2066
- <a name="M000273"></a><b>to_re</b>(esc=false)
2067
- </div>
2068
- <div class="description">
2069
- <p>
2070
- Turns a string into a regular expression.
2071
- </p>
2072
- <pre>
2073
- &quot;a?&quot;.to_re #=&gt; /a?/
2074
- </pre>
2075
- <p>
2076
- CREDIT: Trans
2077
- </p>
2078
- </div>
2079
- <div class="sourcecode">
2080
- <p class="source-link">[ <a href="javascript:toggleSource('M000273_source')" id="l_M000273_source">+</a> ]</p>
2081
- <div id="M000273_source" class="dyn-source">
2082
- <pre>
2083
- <span class="ruby-comment cmt"># File lib/core/facets/string/to_re.rb, line 9</span>
2084
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_re</span>(<span class="ruby-identifier">esc</span>=<span class="ruby-keyword kw">false</span>)
2085
- <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>((<span class="ruby-identifier">esc</span> <span class="ruby-value">? </span><span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>))
2086
- <span class="ruby-keyword kw">end</span>
2087
- </pre>
2088
- </div>
2089
- </div>
2090
- </div>
2091
- <div class="method">
2092
- <div class="title">
2093
- <a name="M000274"></a><b>to_rx</b>(esc=true)
2094
- </div>
2095
- <div class="description">
2096
- <p>
2097
- Turns a string into a regular expression. By default it will escape all
2098
- characters. Use <tt>false</tt> argument to turn off escaping.
2099
- </p>
2100
- <pre>
2101
- &quot;[&quot;.to_rx #=&gt; /\[/
2102
- </pre>
2103
- <p>
2104
- CREDIT: Trans
2105
- </p>
2106
- </div>
2107
- <div class="sourcecode">
2108
- <p class="source-link">[ <a href="javascript:toggleSource('M000274_source')" id="l_M000274_source">+</a> ]</p>
2109
- <div id="M000274_source" class="dyn-source">
2110
- <pre>
2111
- <span class="ruby-comment cmt"># File lib/core/facets/string/to_re.rb, line 21</span>
2112
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_rx</span>(<span class="ruby-identifier">esc</span>=<span class="ruby-keyword kw">true</span>)
2113
- <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>((<span class="ruby-identifier">esc</span> <span class="ruby-value">? </span><span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>))
2114
- <span class="ruby-keyword kw">end</span>
2115
- </pre>
2116
- </div>
2117
- </div>
2118
- </div>
2119
- <div class="method">
2120
- <div class="title">
2121
- <a name="M000319"></a><b>unbracket</b>(bra=nil, ket=nil)
2122
- </div>
2123
- <div class="description">
2124
- <p>
2125
- Return a new string embraced by given brakets. If only one <a
2126
- href="String.html#M000317">bracket</a> char is given it will be placed on
2127
- either side.
2128
- </p>
2129
- <pre>
2130
- &quot;{unwrap me}&quot;.debracket('{') #=&gt; &quot;unwrap me&quot;
2131
- &quot;--unwrap me!&quot;.debracket('--','!') #=&gt; &quot;unwrap me!&quot;
2132
- </pre>
2133
- <p>
2134
- CREDIT: Trans
2135
- </p>
2136
- </div>
2137
- <div class="sourcecode">
2138
- <p class="source-link">[ <a href="javascript:toggleSource('M000319_source')" id="l_M000319_source">+</a> ]</p>
2139
- <div id="M000319_source" class="dyn-source">
2140
- <pre>
2141
- <span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 37</span>
2142
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unbracket</span>(<span class="ruby-identifier">bra</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
2143
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bra</span>
2144
- <span class="ruby-identifier">ket</span> = <span class="ruby-constant">BRA2KET</span>[<span class="ruby-identifier">bra</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ket</span>
2145
- <span class="ruby-identifier">ket</span> = <span class="ruby-identifier">ket</span> <span class="ruby-value">? </span><span class="ruby-identifier">ket</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">bra</span>
2146
- <span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
2147
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">%r[^#{Regexp.escape(bra)}]</span>, <span class="ruby-value str">''</span>)
2148
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">%r[#{Regexp.escape(ket)}$]</span>, <span class="ruby-value str">''</span>)
2149
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
2150
- <span class="ruby-keyword kw">else</span>
2151
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span> = <span class="ruby-constant">BRA2KET</span>[ <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] ]
2152
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">m</span>
2153
- <span class="ruby-keyword kw">end</span>
2154
- <span class="ruby-keyword kw">end</span>
2155
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># if nothing else</span>
2156
- <span class="ruby-keyword kw">end</span>
2157
- </pre>
2158
- </div>
2159
- </div>
2160
- </div>
2161
- <div class="method">
2162
- <div class="title">
2163
- <a name="M000320"></a><b>unbracket!</b>(bra=nil, ket=nil)
2164
- </div>
2165
- <div class="description">
2166
- <p>
2167
- Inplace version of debraket.
2168
- </p>
2169
- <p>
2170
- CREDIT: Trans
2171
- </p>
2172
- </div>
2173
- <div class="sourcecode">
2174
- <p class="source-link">[ <a href="javascript:toggleSource('M000320_source')" id="l_M000320_source">+</a> ]</p>
2175
- <div id="M000320_source" class="dyn-source">
2176
- <pre>
2177
- <span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 57</span>
2178
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unbracket!</span>(<span class="ruby-identifier">bra</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
2179
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">unbracket</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>) )
2180
- <span class="ruby-keyword kw">end</span>
2181
- </pre>
2182
- </div>
2183
- </div>
2184
- </div>
2185
- <div class="method">
2186
- <div class="title">
2187
- <a name="M000302"></a><b>upcase?</b>()
2188
- </div>
2189
- <div class="description">
2190
- <p>
2191
- Is the string upcase/uppercase?
2192
- </p>
2193
- <pre>
2194
- &quot;THIS&quot;.upcase? #=&gt; true
2195
- &quot;This&quot;.upcase? #=&gt; false
2196
- &quot;this&quot;.upcase? #=&gt; false
2197
- </pre>
2198
- <p>
2199
- CREDIT: Phil Tomson
2200
- </p>
2201
- </div>
2202
- <div class="sourcecode">
2203
- <p class="source-link">[ <a href="javascript:toggleSource('M000302_source')" id="l_M000302_source">+</a> ]</p>
2204
- <div id="M000302_source" class="dyn-source">
2205
- <pre>
2206
- <span class="ruby-comment cmt"># File lib/core/facets/string/capitalized.rb, line 38</span>
2207
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upcase?</span>
2208
- <span class="ruby-identifier">upcase</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
2209
- <span class="ruby-keyword kw">end</span>
2210
- </pre>
2211
- </div>
2212
- </div>
2213
- </div>
2214
- <div class="method">
2215
- <div class="title">
2216
- <a name="M000306"></a><b>variablize</b>()
2217
- </div>
2218
- <div class="description">
2219
- <p>
2220
- Prepend an &quot;@&quot; to the beginning of a string to make a instance
2221
- variable name. This also replaces non-valid characters with underscores.
2222
- </p>
2223
- </div>
2224
- <div class="sourcecode">
2225
- <p class="source-link">[ <a href="javascript:toggleSource('M000306_source')" id="l_M000306_source">+</a> ]</p>
2226
- <div id="M000306_source" class="dyn-source">
2227
- <pre>
2228
- <span class="ruby-comment cmt"># File lib/core/facets/string/variablize.rb, line 7</span>
2229
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">variablize</span>
2230
- <span class="ruby-identifier">v</span> = <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\W/</span>, <span class="ruby-value str">'_'</span>)
2231
- <span class="ruby-node">&quot;@#{v}&quot;</span>
2232
- <span class="ruby-keyword kw">end</span>
2233
- </pre>
2234
- </div>
2235
- </div>
2236
- </div>
2237
- <div class="method">
2238
- <div class="title">
2239
- <a name="M000281"></a><b>word_wrap</b>( col_width=80 )
2240
- </div>
2241
- <div class="description">
2242
- <p>
2243
- Word wrap a string not exceeding max width.
2244
- </p>
2245
- <pre>
2246
- puts &quot;this is a test&quot;.word_wrap(4)
2247
- </pre>
2248
- <p>
2249
- <em>produces</em>
2250
- </p>
2251
- <pre>
2252
- this
2253
- is a
2254
- test
2255
- </pre>
2256
- <p>
2257
- This is basic implementation of word wrap, but smart enough to suffice for
2258
- most use cases.
2259
- </p>
2260
- <p>
2261
- CREDIT: Gavin Kistner, Dayne Broderson
2262
- </p>
2263
- </div>
2264
- <div class="sourcecode">
2265
- <p class="source-link">[ <a href="javascript:toggleSource('M000281_source')" id="l_M000281_source">+</a> ]</p>
2266
- <div id="M000281_source" class="dyn-source">
2267
- <pre>
2268
- <span class="ruby-comment cmt"># File lib/core/facets/string/word_wrap.rb, line 18</span>
2269
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">word_wrap</span>( <span class="ruby-identifier">col_width</span>=<span class="ruby-value">80</span> )
2270
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">word_wrap!</span>( <span class="ruby-identifier">col_width</span> )
2271
- <span class="ruby-keyword kw">end</span>
2272
- </pre>
2273
- </div>
2274
- </div>
2275
- </div>
2276
- <div class="method">
2277
- <div class="title">
2278
- <a name="M000282"></a><b>word_wrap!</b>( col_width=80 )
2279
- </div>
2280
- <div class="description">
2281
- <p>
2282
- As with <a href="String.html#M000281">word_wrap</a>, but modifies the
2283
- string in place.
2284
- </p>
2285
- <p>
2286
- CREDIT: Gavin Kistner, Dayne Broderson
2287
- </p>
2288
- </div>
2289
- <div class="sourcecode">
2290
- <p class="source-link">[ <a href="javascript:toggleSource('M000282_source')" id="l_M000282_source">+</a> ]</p>
2291
- <div id="M000282_source" class="dyn-source">
2292
- <pre>
2293
- <span class="ruby-comment cmt"># File lib/core/facets/string/word_wrap.rb, line 26</span>
2294
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">word_wrap!</span>( <span class="ruby-identifier">col_width</span>=<span class="ruby-value">80</span> )
2295
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub!</span>( <span class="ruby-node">/(\S{#{col_width}})(?=\S)/</span>, <span class="ruby-value str">'\1 '</span> )
2296
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub!</span>( <span class="ruby-node">/(.{1,#{col_width}})(?:\s+|$)/</span>, <span class="ruby-value str">&quot;\\1\n&quot;</span> )
2297
- <span class="ruby-keyword kw">self</span>
2298
- <span class="ruby-keyword kw">end</span>
2299
- </pre>
2300
- </div>
2301
- </div>
2302
- </div>
2303
- <div class="method">
2304
- <div class="title">
2305
- <a name="M000313"></a><b>words</b>()
2306
- </div>
2307
- <div class="description">
2308
- <p>
2309
- Returns an array of characters.
2310
- </p>
2311
- <pre>
2312
- &quot;abc 123&quot;.words #=&gt; [&quot;abc&quot;,&quot;123&quot;]
2313
- </pre>
2314
- </div>
2315
- <div class="sourcecode">
2316
- <p class="source-link">[ <a href="javascript:toggleSource('M000313_source')" id="l_M000313_source">+</a> ]</p>
2317
- <div id="M000313_source" class="dyn-source">
2318
- <pre>
2319
- <span class="ruby-comment cmt"># File lib/core/facets/string/words.rb, line 7</span>
2320
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">words</span>
2321
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\s+/</span>)
2322
- <span class="ruby-keyword kw">end</span>
2323
- </pre>
2324
- </div>
2325
- </div>
2326
- </div>
2327
- </div>
2328
-
2329
- </div>
2330
-
2331
- </body>
2332
- </html>