facets 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.rdoc +331 -35
- data/MANIFEST +685 -826
- data/{doc/guide/notes.rd → NOTES} +0 -0
- data/README.rdoc +73 -25
- data/Rakefile +245 -2
- data/TODO +5 -0
- data/demo/hook.rd +47 -0
- data/demo/scenario_require.rd +9 -0
- data/doc/README.more +24 -6
- data/doc/manual/about.rb +47 -0
- data/doc/manual/annotations.rdoc +60 -0
- data/doc/manual/associations.rdoc +55 -0
- data/doc/manual/blockups.rdoc +101 -0
- data/doc/manual/capsule.rdoc +34 -0
- data/doc/manual/command.rdoc +177 -0
- data/doc/manual/core.rdoc +37 -0
- data/doc/manual/faq.rdoc +32 -0
- data/doc/manual/typecast.html +112 -0
- data/lib/core/facets.rb +359 -11
- data/lib/core/facets/array/combination.rb +3 -3
- data/lib/core/facets/array/index.rb +4 -1
- data/lib/core/facets/array/permutation.rb +2 -2
- data/lib/core/facets/array/product.rb +1 -1
- data/lib/core/facets/binding/eval.rb +1 -1
- data/lib/core/facets/denumerable.rb +76 -0
- data/lib/core/facets/duplicable.rb +34 -0
- data/lib/core/facets/enumerable/count.rb +10 -4
- data/lib/core/facets/enumerable/defer.rb +77 -0
- data/lib/core/facets/enumerable/each_by.rb +1 -1
- data/lib/core/facets/enumerable/every.rb +35 -0
- data/lib/{more/facets/elementwise.rb → core/facets/enumerable/ewise.rb} +0 -0
- data/lib/core/facets/enumerable/filter.rb +25 -0
- data/lib/core/facets/enumerable/group_by.rb +1 -1
- data/lib/core/facets/enumerable/none.rb +3 -2
- data/lib/core/facets/enumerable/one.rb +3 -2
- data/lib/core/facets/enumerable/per.rb +61 -0
- data/lib/core/facets/exception/raised.rb +14 -0
- data/lib/core/facets/integer/odd.rb +5 -1
- data/lib/core/facets/kernel/__dir__.rb +13 -3
- data/lib/core/facets/kernel/__here__.rb +14 -0
- data/lib/core/facets/kernel/__method__.rb +9 -3
- data/lib/core/facets/kernel/ask.rb +1 -0
- data/lib/core/facets/kernel/equate.rb +13 -0
- data/lib/core/facets/kernel/extension.rb +9 -0
- data/lib/core/facets/kernel/identical.rb +4 -0
- data/lib/core/facets/kernel/instance_exec.rb +2 -1
- data/lib/core/facets/kernel/method.rb +49 -0
- data/lib/core/facets/kernel/object_send.rb +2 -2
- data/lib/core/facets/kernel/{state.rb → object_state.rb} +23 -12
- data/lib/core/facets/kernel/require_all.rb +6 -1
- data/lib/core/facets/kernel/require_local.rb +8 -1
- data/lib/core/facets/kernel/require_relative.rb +52 -0
- data/lib/core/facets/kernel/source_location.rb +13 -0
- data/lib/core/facets/kernel/tap.rb +13 -6
- data/lib/core/facets/module/attr_setter.rb +57 -0
- data/lib/core/facets/module/instance_method.rb +24 -0
- data/lib/core/facets/module/module_load.rb +60 -44
- data/lib/core/facets/module/module_require.rb +1 -0
- data/lib/core/facets/nilclass/to_f.rb +1 -1
- data/lib/core/facets/objectspace/op_fetch.rb +3 -0
- data/lib/core/facets/proc/curry.rb +4 -3
- data/lib/core/facets/string/bytes.rb +10 -4
- data/lib/core/facets/string/camelcase.rb +6 -5
- data/lib/core/facets/string/chars.rb +5 -1
- data/lib/core/facets/string/each_char.rb +1 -1
- data/lib/core/facets/string/each_word.rb +1 -1
- data/lib/core/facets/string/lines.rb +11 -4
- data/lib/core/facets/string/start_with.rb +9 -2
- data/lib/core/facets/string/unfold.rb +27 -0
- data/lib/core/facets/symbol/succ.rb +3 -3
- data/lib/core/facets/symbol/thrown.rb +20 -0
- data/lib/core/facets/symbol/to_proc.rb +3 -2
- data/lib/core/facets/time/to_time.rb +1 -1
- data/lib/core/facets/to_hash.rb +41 -100
- data/lib/core/facets/unboundmethod/name.rb +20 -23
- data/lib/more/facets/ansicode.rb +1 -10
- data/lib/more/facets/autoarray.rb +3 -31
- data/lib/more/facets/basicobject.rb +73 -0
- data/lib/more/facets/blankslate.rb +2 -66
- data/lib/{lore → more}/facets/cgi.rb +0 -0
- data/lib/more/facets/class_extend.rb +1 -0
- data/lib/{lore → more}/facets/continuation.rb +0 -0
- data/lib/{lore → more}/facets/date.rb +3 -3
- data/lib/more/facets/enumargs.rb +192 -0
- data/lib/more/facets/enumerablepass.rb +2 -216
- data/lib/more/facets/enumerator.rb +62 -0
- data/lib/more/facets/{equatable.rb → equitable.rb} +11 -11
- data/lib/more/facets/expirable.rb +13 -41
- data/lib/{lore → more}/facets/fileutils.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/head.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/safe_ln.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/slice.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/tail.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/wc.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/whereis.rb +0 -0
- data/lib/{lore → more}/facets/fileutils/which.rb +0 -0
- data/lib/{lore → more}/facets/getoptlong.rb +0 -0
- data/lib/more/facets/hook.rb +2 -29
- data/lib/more/facets/inheritor.rb +2 -2
- data/lib/more/facets/instance_eval.rb +50 -0
- data/lib/more/facets/instance_function.rb +78 -0
- data/lib/more/facets/main.rb +20 -15
- data/lib/more/facets/memoize.rb +1 -113
- data/lib/more/facets/module/attr.rb +83 -0
- data/lib/more/facets/module/attr_tester.rb +44 -0
- data/lib/more/facets/module/attr_toggler.rb +59 -0
- data/lib/more/facets/module/attr_validator.rb +34 -0
- data/lib/more/facets/{class_extension.rb → module/class_extend.rb} +21 -13
- data/lib/more/facets/once.rb +59 -0
- data/lib/more/facets/openmodule.rb +1 -0
- data/lib/more/facets/orderedhash.rb +1 -33
- data/lib/{lore → more}/facets/ostruct.rb +0 -0
- data/lib/more/facets/ostructable.rb +1 -4
- data/lib/more/facets/partial.rb +18 -16
- data/lib/{lore → more}/facets/pathname.rb +0 -0
- data/lib/more/facets/preinitialize.rb +157 -0
- data/lib/{lore → more}/facets/rbconfig.rb +0 -0
- data/lib/more/facets/recorder.rb +1 -2
- data/lib/{lore → more}/facets/set.rb +0 -0
- data/lib/{lore → more}/facets/shellwords.rb +0 -0
- data/lib/{lore → more}/facets/uri.rb +0 -0
- data/lib/{lore → more}/facets/yaml.rb +0 -0
- data/lib/{lore → more}/facets/zlib.rb +0 -0
- data/meta/loadpath +0 -1
- data/meta/sitemap +4 -0
- data/meta/version +1 -1
- data/test/core/enumerable/test_count.rb +1 -1
- data/test/{more/test_filter.rb → core/enumerable/test_defer.rb} +24 -22
- data/test/{more/test_elementor.rb → core/enumerable/test_every.rb} +2 -15
- data/test/core/enumerable/test_ewise.rb +23 -0
- data/test/core/enumerable/test_per.rb +18 -0
- data/test/core/enumerable/test_take.rb +13 -0
- data/test/core/kernel/test_deepcopy.rb +1 -1
- data/test/{more/test_1stclassmethod.rb → core/kernel/test_method.rb} +2 -7
- data/test/core/kernel/test_tap.rb +1 -1
- data/test/core/proc/test_curry.rb +11 -0
- data/test/core/string/test_bytes.rb +1 -1
- data/test/core/string/test_camelcase.rb +23 -6
- data/test/core/string/test_lines.rb +1 -1
- data/test/core/string/test_unfold.rb +14 -0
- data/test/{more → core}/test_blank.rb +0 -0
- data/test/{more → core}/test_boolean.rb +0 -0
- data/test/{more → core}/test_functor.rb +0 -0
- data/test/{lore → more}/test_basicobject.rb +0 -0
- data/test/more/{test_class_extension.rb → test_class_extend.rb} +6 -6
- data/test/{lore → more}/test_continuation.rb +0 -0
- data/test/{lore → more}/test_date.rb +0 -0
- data/test/more/{test_enumerablepass.rb → test_enumargs.rb} +2 -4
- data/test/more/{test_equatable.rb → test_equitable.rb} +2 -2
- data/test/more/{test_instantise.rb → test_instance_function.rb} +3 -2
- data/test/more/test_memoize.rb +1 -1
- data/test/{lore → more}/test_ostruct.rb +0 -0
- metadata +865 -1016
- data/RELEASE +0 -38
- data/doc/README.lore +0 -51
- data/doc/log/basic_stats/index.html +0 -39
- data/doc/log/changelog.html +0 -648
- data/doc/log/changelog.txt +0 -217
- data/doc/log/stats/index.html +0 -39
- data/doc/log/testlog.txt +0 -278
- data/doc/notes/CHANGES +0 -2529
- data/doc/rdoc/lore/classes/Array.html +0 -176
- data/doc/rdoc/lore/classes/CGI.html +0 -191
- data/doc/rdoc/lore/classes/Config.html +0 -135
- data/doc/rdoc/lore/classes/Continuation.html +0 -113
- data/doc/rdoc/lore/classes/Date.html +0 -631
- data/doc/rdoc/lore/classes/DateTime.html +0 -583
- data/doc/rdoc/lore/classes/Enumerable.html +0 -89
- data/doc/rdoc/lore/classes/Enumerable/Enumerator.html +0 -147
- data/doc/rdoc/lore/classes/File.html +0 -128
- data/doc/rdoc/lore/classes/FileUtils.html +0 -434
- data/doc/rdoc/lore/classes/GetoptLong.html +0 -118
- data/doc/rdoc/lore/classes/GetoptLong/DSL.html +0 -208
- data/doc/rdoc/lore/classes/Kernel.html +0 -135
- data/doc/rdoc/lore/classes/Logger.html +0 -229
- data/doc/rdoc/lore/classes/Logger/Ansicolor.html +0 -277
- data/doc/rdoc/lore/classes/Logger/LogDevice.html +0 -121
- data/doc/rdoc/lore/classes/NilClass.html +0 -119
- data/doc/rdoc/lore/classes/OpenStruct.html +0 -432
- data/doc/rdoc/lore/classes/Pathname.html +0 -353
- data/doc/rdoc/lore/classes/Set.html +0 -117
- data/doc/rdoc/lore/classes/Shellwords.html +0 -111
- data/doc/rdoc/lore/classes/String.html +0 -140
- data/doc/rdoc/lore/classes/Time.html +0 -154
- data/doc/rdoc/lore/classes/URI.html +0 -454
- data/doc/rdoc/lore/classes/URI/Hash.html +0 -105
- data/doc/rdoc/lore/classes/URI/Kernel.html +0 -122
- data/doc/rdoc/lore/classes/Zlib.html +0 -188
- data/doc/rdoc/lore/created.rid +0 -1
- data/doc/rdoc/lore/files/README.html +0 -286
- data/doc/rdoc/lore/files/doc/README_lore.html +0 -155
- data/doc/rdoc/lore/files/lib/lore/facets/basicobject_rb.html +0 -118
- data/doc/rdoc/lore/files/lib/lore/facets/cgi_rb.html +0 -111
- data/doc/rdoc/lore/files/lib/lore/facets/continuation_rb.html +0 -147
- data/doc/rdoc/lore/files/lib/lore/facets/date_rb.html +0 -97
- data/doc/rdoc/lore/files/lib/lore/facets/enumerator_rb.html +0 -111
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/head_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/safe_ln_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/slice_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/tail_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/wc_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/whereis_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils/which_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/fileutils_rb.html +0 -131
- data/doc/rdoc/lore/files/lib/lore/facets/getoptlong_rb.html +0 -135
- data/doc/rdoc/lore/files/lib/lore/facets/logger_rb.html +0 -142
- data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +0 -135
- data/doc/rdoc/lore/files/lib/lore/facets/pathname_rb.html +0 -145
- data/doc/rdoc/lore/files/lib/lore/facets/rbconfig_rb.html +0 -124
- data/doc/rdoc/lore/files/lib/lore/facets/set_rb.html +0 -96
- data/doc/rdoc/lore/files/lib/lore/facets/shellwords_rb.html +0 -124
- data/doc/rdoc/lore/files/lib/lore/facets/uri_rb.html +0 -125
- data/doc/rdoc/lore/files/lib/lore/facets/yaml_rb.html +0 -146
- data/doc/rdoc/lore/files/lib/lore/facets/zlib_rb.html +0 -97
- data/doc/rdoc/lore/fr_class_index.html +0 -73
- data/doc/rdoc/lore/fr_file_index.html +0 -71
- data/doc/rdoc/lore/fr_method_index.html +0 -177
- data/doc/rdoc/lore/index.html +0 -26
- data/doc/rdoc/lore/rdoc-style.css +0 -177
- data/doc/release-notes/RELEASE-2.0.5 +0 -8
- data/doc/release-notes/RELEASE-2.1.0 +0 -9
- data/doc/release-notes/RELEASE-2.1.1 +0 -5
- data/doc/release-notes/RELEASE-2.1.2 +0 -6
- data/doc/release-notes/RELEASE-2.1.3 +0 -5
- data/doc/release-notes/RELEASE-2.2.0 +0 -14
- data/doc/release-notes/RELEASE-2.2.1 +0 -4
- data/doc/release-notes/RELEASE-2.3.0 +0 -6
- data/doc/release-notes/RELEASE-2.4.0 +0 -70
- data/doc/release-notes/RELEASE-2.4.1 +0 -8
- data/doc/release-notes/RELEASE-2.4.2 +0 -4
- data/doc/release-notes/RELEASE-2.4.3 +0 -78
- data/doc/release-notes/RELEASE-2.4.4 +0 -38
- data/doc/release-notes/RELEASE-2.4.5 +0 -37
- data/doc/release-notes/RELEASE-2.5.0 +0 -83
- data/lib/core/facets/kernel/instance.rb +0 -19
- data/lib/lore/facets/basicobject.rb +0 -14
- data/lib/lore/facets/enumerator.rb +0 -67
- data/lib/lore/facets/logger.rb +0 -291
- data/lib/more/facets/1stclassmethod.rb +0 -140
- data/lib/more/facets/advisable.rb +0 -162
- data/lib/more/facets/association.rb +0 -210
- data/lib/more/facets/attr.rb +0 -209
- data/lib/more/facets/basex.rb +0 -37
- data/lib/more/facets/bbcode.rb +0 -397
- data/lib/more/facets/bicrypt.rb +0 -265
- data/lib/more/facets/binreadable.rb +0 -221
- data/lib/more/facets/censor.rb +0 -97
- data/lib/more/facets/classmethods.rb +0 -199
- data/lib/more/facets/consoleutils.rb +0 -99
- data/lib/more/facets/crypt.rb +0 -166
- data/lib/more/facets/dependency.rb +0 -151
- data/lib/more/facets/downloader.rb +0 -281
- data/lib/more/facets/duplicable.rb +0 -43
- data/lib/more/facets/elementor.rb +0 -133
- data/lib/more/facets/filter.rb +0 -121
- data/lib/more/facets/heap.rb +0 -22
- data/lib/more/facets/infinity.rb +0 -193
- data/lib/more/facets/ini.rb +0 -264
- data/lib/more/facets/instantise.rb +0 -1
- data/lib/more/facets/instantize.rb +0 -95
- data/lib/more/facets/interval.rb +0 -282
- data/lib/more/facets/iteration.rb +0 -65
- data/lib/more/facets/linkedlist.rb +0 -222
- data/lib/more/facets/lrucache.rb +0 -157
- data/lib/more/facets/matcher.rb +0 -140
- data/lib/more/facets/memoizer.rb +0 -74
- data/lib/more/facets/minitar.rb +0 -1063
- data/lib/more/facets/nackclass.rb +0 -41
- data/lib/more/facets/net/smtp_tls.rb +0 -131
- data/lib/more/facets/nilstatus.rb +0 -48
- data/lib/more/facets/overload.rb +0 -94
- data/lib/more/facets/paramix.rb +0 -202
- data/lib/more/facets/pool.rb +0 -91
- data/lib/more/facets/pqueue.rb +0 -449
- data/lib/more/facets/pry.rb +0 -32
- data/lib/more/facets/reflection.rb +0 -145
- data/lib/more/facets/semaphore.rb +0 -92
- data/lib/more/facets/settings.rb +0 -248
- data/lib/more/facets/snapshot.rb +0 -209
- data/lib/more/facets/sparse_array.rb +0 -809
- data/lib/more/facets/string/mask.rb +0 -278
- data/lib/more/facets/string/obfuscate.rb +0 -65
- data/lib/more/facets/string/stylize.rb +0 -169
- data/lib/more/facets/string/words.rb +0 -167
- data/lib/more/facets/syncarray.rb +0 -114
- data/lib/more/facets/synchash.rb +0 -157
- data/lib/more/facets/typecast.rb +0 -261
- data/lib/more/facets/uninheritable.rb +0 -50
- data/lib/more/facets/xmlhash.rb +0 -112
- data/lib/more/facets/xoxo.rb +0 -259
- data/lib/more/facets/ziputils.rb +0 -490
- data/task/conflicts +0 -63
- data/task/coverage.rake +0 -37
- data/task/methods +0 -49
- data/task/rdoc.rake +0 -17
- data/task/setup.rake +0 -38
- data/task/test.rake +0 -145
- data/test/more/test_advisable.rb +0 -71
- data/test/more/test_association.rb +0 -38
- data/test/more/test_bbcode.rb +0 -21
- data/test/more/test_binreadable.rb +0 -50
- data/test/more/test_buildable.rb +0 -73
- data/test/more/test_classmethods.rb +0 -56
- data/test/more/test_crypt.rb +0 -32
- data/test/more/test_dependency.rb +0 -69
- data/test/more/test_elementwise.rb +0 -25
- data/test/more/test_infinity.rb +0 -40
- data/test/more/test_interval.rb +0 -151
- data/test/more/test_linkedlist.rb +0 -41
- data/test/more/test_lrucache.rb +0 -14
- data/test/more/test_overload.rb +0 -160
- data/test/more/test_paramix.rb +0 -170
- data/test/more/test_prototype.rb +0 -35
- data/test/more/test_snapshot.rb +0 -21
- data/test/more/test_sparsearray.rb +0 -279
- data/test/more/test_syncarray.rb +0 -15
- data/test/more/test_synchash.rb +0 -16
- data/test/more/test_typecast.rb +0 -54
- data/test/more/test_uninheritable.rb +0 -31
- data/test/more/test_xoxo.rb +0 -274
- data/test/test_facets.rb +0 -9
File without changes
|
data/README.rdoc
CHANGED
@@ -7,23 +7,43 @@
|
|
7
7
|
|
8
8
|
== Introduction
|
9
9
|
|
10
|
-
Ruby Facets is the single largest collection of general purpose method
|
10
|
+
Ruby Facets is the single largest collection of general purpose method
|
11
|
+
extensions and system additions for the Ruby programming language.
|
11
12
|
|
12
|
-
The
|
13
|
+
The CORE extensions is a large collection of methods which extend the
|
14
|
+
core capabilities of Ruby's built-in classes and modules. This collection
|
15
|
+
of extension methods are unique by virtue of their atomicity. The methods
|
16
|
+
are generally stored in individual files so that each can be required
|
17
|
+
independently. This gives developers the potential for much finer control
|
18
|
+
over which extra methods to bring into their code.
|
13
19
|
|
14
|
-
The
|
20
|
+
The MORE additions are a collection of classes, modules and lightweight systems
|
21
|
+
which constitute an ever improving source of reusable components. This set of
|
22
|
+
libraries is kept light and focused on useful to a wide variety of usecases.
|
15
23
|
|
16
24
|
|
17
|
-
==
|
25
|
+
== Release Notes
|
18
26
|
|
19
|
-
|
27
|
+
Please see Facets Blog (http://facets.rubyforge.org).
|
20
28
|
|
21
|
-
Online documentaiton is available at http://facets.rubyforge.org/learn.html. There is a "Quick Doc" feature that can be a bit more convenient then the usual RDocs. Prior to 2.3.1 off-line docs had to be downloaded via a separate package, but this is no longer the case. I've seen past the stigma of not including documentation along with the package itself (the extra 500K isn't even a floppy disk folks!), so you will find them in the doc/ directory of whatever package you have choosen to install. In fact, a good package installer should give you the option to install those in the appropriate place in your system (eg. in /usr/share/doc/facets/).
|
22
29
|
|
30
|
+
== Documentation
|
23
31
|
|
24
|
-
|
32
|
+
Facets has special documentation needs due to it's extensive bredth.
|
33
|
+
The RDocs generated when installing via RubyGems, are unweildly because it
|
34
|
+
combines all of Facets in one set of docs. Hopefully we can remedy this in
|
35
|
+
the future. In the mean time the gem package includes better documentation
|
36
|
+
--divided into two sections in the doc/rdoc directory.
|
25
37
|
|
26
|
-
|
38
|
+
Online documentaiton is available at http://facets.rubyforge.org/learn.html.
|
39
|
+
There is a "Quick Doc" feature that can be a bit more convenient then the usual
|
40
|
+
RDocs. Prior to 2.3.1 off-line docs had to be downloaded via a separate package,
|
41
|
+
but this is no longer the case. I've seen past the stigma of not including
|
42
|
+
documentation along with the package itself (the extra 500K isn't even a floppy
|
43
|
+
disk folks!), so you will find them in the doc/ directory of whatever package
|
44
|
+
you have choosen to install. In fact, a good package installer should give you
|
45
|
+
the option to install those in the appropriate place in your system anyway
|
46
|
+
(eg. in /usr/share/doc/facets/).
|
27
47
|
|
28
48
|
|
29
49
|
== Installation
|
@@ -32,7 +52,8 @@ The easiest way to install is via RubyGems.
|
|
32
52
|
|
33
53
|
$ gem install facets
|
34
54
|
|
35
|
-
To install manually, your will need Ruby Setup (http::/setup.rubyforge.org).
|
55
|
+
To install manually, your will need Ruby Setup (http::/setup.rubyforge.org).
|
56
|
+
Then download and unpack the .tar.gz package and run:
|
36
57
|
|
37
58
|
$ tar -xvzf facets-2.x.x.tar.gz
|
38
59
|
$ cd facets-2.x.x
|
@@ -41,12 +62,19 @@ To install manually, your will need Ruby Setup (http::/setup.rubyforge.org). The
|
|
41
62
|
|
42
63
|
== Compatibility with 1.x series.
|
43
64
|
|
44
|
-
Prior to 2.0, Facets was divided between CORE and MORE --standalone extensions
|
65
|
+
Prior to 2.0, Facets was divided between CORE and MORE --standalone extensions
|
66
|
+
vs. classes and modules, respectively. With 2.0, the notion of "CORE" has taken
|
67
|
+
on a slightly different meaning. Instead CORE now consists of the libraries that
|
68
|
+
are thought "essential" and as such are loaded automatically when using
|
69
|
+
++require "facets"++. While still primarily made up of extension methods, some
|
70
|
+
modules and classes may now belong to core as well.
|
45
71
|
|
46
72
|
|
47
73
|
== Mission
|
48
74
|
|
49
|
-
Facets holds to the notion that the more we can reasonably integrate into
|
75
|
+
Facets holds to the notion that the more we can reasonably integrate into
|
76
|
+
a common foundation, directed toward general needs, the better that foundation
|
77
|
+
will be able to serve the community. There are a number of advantages here:
|
50
78
|
|
51
79
|
* Better Code-reuse
|
52
80
|
* Collaborative Improvements
|
@@ -56,48 +84,64 @@ Facets holds to the notion that the more we can reasonably integrate into a comm
|
|
56
84
|
|
57
85
|
== Usage
|
58
86
|
|
59
|
-
For information in usage, please see the special README for the specific
|
87
|
+
For information in usage, please see the special README for the specific
|
88
|
+
set of libraries:
|
60
89
|
|
61
|
-
README.core Core
|
62
|
-
README.
|
63
|
-
README.more Additions
|
90
|
+
README.core Core Extensions
|
91
|
+
README.more Standard Extensions & Additions
|
64
92
|
|
65
93
|
General usage of the CORE library is provided via:
|
66
94
|
|
67
95
|
require 'facets'
|
68
96
|
|
69
|
-
This is the recommended usage. However, you can also "cherry pick" core
|
97
|
+
This is the recommended usage. However, you can also "cherry pick" core
|
98
|
+
methods. While there are exceptions the rule of thumb for loading a core
|
99
|
+
method is:
|
70
100
|
|
71
101
|
require 'facets/{class|module}/{method}'
|
72
102
|
|
73
103
|
See README.core for more information.
|
74
104
|
|
75
|
-
Using the Facets/MORE library of modules, classes or microframeworks is
|
105
|
+
Using the Facets/MORE library of modules, classes or microframeworks is
|
106
|
+
essentially the same. For example:
|
76
107
|
|
77
108
|
require 'facets/basicobject'
|
78
109
|
|
79
|
-
Again, for details pertaining to the functionality of each feature, please see
|
110
|
+
Again, for details pertaining to the functionality of each feature, please see
|
111
|
+
the API Docs.
|
80
112
|
|
81
113
|
|
82
114
|
== Contribute
|
83
115
|
|
84
116
|
This project thrives on contribution.
|
85
117
|
|
86
|
-
If you have any extension methods, classes, modules or small frameworks that
|
118
|
+
If you have any extension methods, classes, modules or small frameworks that
|
119
|
+
you think have general applicability and would like to see them included in
|
120
|
+
this project, don't hesitiate to submit. Also, if you have better versions
|
121
|
+
of any thing already included or simply have a patch, they are more than
|
122
|
+
welcome. We want Ruby Facets to be of the highest quality.
|
87
123
|
|
88
124
|
|
89
125
|
== Authors
|
90
126
|
|
91
|
-
This collection was put together by, and largely written by Thomas Sawyer
|
127
|
+
This collection was put together by, and largely written by Thomas Sawyer
|
128
|
+
(aka Trans). He can be reached via email at transfire at gmail.com.
|
92
129
|
|
93
|
-
Some parts of this collection were written and/or inspired by other persons.
|
130
|
+
Some parts of this collection were written and/or inspired by other persons.
|
131
|
+
Fortunately nearly all were copyrighted under the same open license, the Ruby
|
132
|
+
License. In the few exceptions I have included the copyright notice with the
|
133
|
+
source code.
|
94
134
|
|
95
135
|
Any code file not specifically labeled shall fall under the Ruby License.
|
96
136
|
|
97
|
-
In all cases, I have made every effort to give credit where credit is due.
|
137
|
+
In all cases, I have made every effort to give credit where credit is due.
|
138
|
+
You will find these copyrights, thanks and acknowledgments embedded in the
|
139
|
+
source code. You can see them in "CREDIT:" lines or as file-base "Author(s)"
|
140
|
+
sections given in the RDocs.
|
98
141
|
|
99
142
|
Also see the AUTHORS file for a list of all contributing Rubyists.
|
100
|
-
If anyone is missing from the list, please let me know and I will correct
|
143
|
+
If anyone is missing from the list, please let me know and I will correct
|
144
|
+
right away. Thanks.
|
101
145
|
|
102
146
|
|
103
147
|
== License
|
@@ -109,9 +153,13 @@ The collection PER COLLECTION is licensed as follows:
|
|
109
153
|
|
110
154
|
Distributed under the terms of the Ruby license.
|
111
155
|
|
112
|
-
The Ruby license is a dual license that also provides for use of the GPL.
|
156
|
+
The Ruby license is a dual license that also provides for use of the GPL.
|
157
|
+
Complete texts of both licenses accompany this document (see LICENSE).
|
113
158
|
|
114
|
-
Acknowledgments and Copyrights for particular snippets of borrowed code
|
159
|
+
Acknowledgments and Copyrights for particular snippets of borrowed code
|
160
|
+
are given in their respective source. All licenses are either compatible
|
161
|
+
with the Ruby license (namely the GPL) or the original author has given
|
162
|
+
permission for inclusion of their code under such license.
|
115
163
|
|
116
164
|
|
117
165
|
Ruby Facets, Copyright (c)2005,2006,2007,2008 Thomas Sawyer / Tiger Ops
|
data/Rakefile
CHANGED
@@ -1,4 +1,247 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
#
|
6
|
+
# CORE TEST COVERAGE
|
7
|
+
# ----------------------------------------------------------------------------
|
8
|
+
|
9
|
+
desc "show core unit test coverage"
|
10
|
+
|
11
|
+
task 'coverage' do
|
12
|
+
core_scripts = []
|
13
|
+
cd 'lib/core/facets' do
|
14
|
+
core_scripts = Dir['**/*'].reject{ |s| File.directory?(s) }
|
15
|
+
end
|
16
|
+
|
17
|
+
core_tests = []
|
18
|
+
cd 'test/core' do
|
19
|
+
core_tests = Dir['**/*']
|
20
|
+
end
|
21
|
+
|
22
|
+
core_tests = core_tests.collect do |t|
|
23
|
+
dir, fname = *File.split(t)
|
24
|
+
File.join(dir, fname.sub(/^test_/,''))
|
25
|
+
end
|
26
|
+
|
27
|
+
diff = core_scripts - core_tests
|
28
|
+
|
29
|
+
# remove core collectives
|
30
|
+
diff = diff - %w{
|
31
|
+
array.rb binding.rb cattr.rb class.rb comparable.rb dir.rb
|
32
|
+
enumerable.rb exception.rb hash.rb file.rb filetest.rb float.rb
|
33
|
+
integer.rb kernel.rb matchdata.rb module.rb nilclass.rb
|
34
|
+
numeric.rb proc.rb range.rb regexp.rb string.rb symbol.rb
|
35
|
+
time.rb unboundmethod.rb
|
36
|
+
}
|
37
|
+
|
38
|
+
puts diff.sort.join("\n")
|
39
|
+
puts
|
40
|
+
puts "#{diff.size} files uncovered."
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
#
|
46
|
+
# GENERATE RDOCS
|
47
|
+
# ----------------------------------------------------------------------------
|
48
|
+
|
49
|
+
desc "generate rdocs"
|
50
|
+
|
51
|
+
task "rdoc" do
|
52
|
+
TEMPLATE = ENV['RDOC_TEMPLATE'] || 'html'
|
53
|
+
APIOUT = "doc/rdoc"
|
54
|
+
|
55
|
+
FileUtils.rm_r(APIOUT)
|
56
|
+
|
57
|
+
system "rdoc -a -S -t'Facets Core API' -T #{TEMPLATE} -m README --op '#{APIOUT}/core' README lib/facets/core"
|
58
|
+
#system "rdoc -a -S -t'Facets Lore API' -T #{TEMPLATE} -m README --op '#{APIOUT}/lore' README lib/facets/lore"
|
59
|
+
system "rdoc -a -S -t'Facets More API' -T #{TEMPLATE} -m README --op '#{APIOUT}/more' README lib/facets/more"
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# RUN TESTS
|
64
|
+
# ----------------------------------------------------------------------------
|
65
|
+
|
66
|
+
task 'test' do
|
67
|
+
prepare_tests_all
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "run all unit tests"
|
71
|
+
task 'test:all' do
|
72
|
+
prepare_tests_all
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "run core unit tests"
|
76
|
+
task 'test:core' do
|
77
|
+
prepare_tests_core
|
78
|
+
end
|
79
|
+
|
80
|
+
#desc "run lore unit tests"
|
81
|
+
#task 'test:lore' do
|
82
|
+
# prepare_tests_lore
|
83
|
+
#end
|
84
|
+
|
85
|
+
desc "run more unit tests"
|
86
|
+
task 'test:more' do
|
87
|
+
prepare_tests_more
|
88
|
+
end
|
89
|
+
|
90
|
+
desc "run all unit tests with ActiveSupport loaded"
|
91
|
+
task 'test:all:activesupport' => [:include_activesupport, 'test:all']
|
92
|
+
|
93
|
+
desc "run core unit tests with ActiveSupport loaded"
|
94
|
+
task 'test:core:activesupport' => [:include_activesupport, 'test:core']
|
95
|
+
|
96
|
+
#desc "run lore unit tests with ActiveSupport loaded"
|
97
|
+
#task 'test:lore:activesupport' => [:include_activesupport, 'test:lore']
|
98
|
+
|
99
|
+
desc "run more unit tests with ActiveSupport loaded"
|
100
|
+
task 'test:more:activesupport' => [:include_activesupport, 'test:more']
|
101
|
+
|
102
|
+
task 'include_activesupport' do
|
103
|
+
require 'activesupport'
|
104
|
+
end
|
105
|
+
|
106
|
+
def add_loadpath(*paths)
|
107
|
+
live = ENV['live']
|
108
|
+
|
109
|
+
unless live
|
110
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/core'))
|
111
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/lore'))
|
112
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/more'))
|
113
|
+
paths.each do |path|
|
114
|
+
$LOAD_PATH.unshift(File.expand_path(path))
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
puts "RUBY VERSION: #{RUBY_VERSION}"
|
119
|
+
puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
|
120
|
+
end
|
121
|
+
|
122
|
+
def get_tests(which="{c,l,m}ore")
|
123
|
+
if find = ARGV[1..-1].select{|e| e !~ /(^[-]|[=])/ }[0]
|
124
|
+
unless FileTest.file?(find)
|
125
|
+
#find = File.join(find, '**', 'test_*.rb')
|
126
|
+
find = ['test/test_*.rb']
|
127
|
+
find << File.join(find, which, '**', 'test_*.rb')
|
128
|
+
end
|
129
|
+
else
|
130
|
+
#find = 'test/**/test_*.rb'
|
131
|
+
find = ['test/test_*.rb']
|
132
|
+
find << "test/#{which}/**/test_*.rb"
|
133
|
+
end
|
134
|
+
|
135
|
+
Dir.glob(find)
|
136
|
+
end
|
137
|
+
|
138
|
+
def run_tests(files)
|
139
|
+
files.each do |file|
|
140
|
+
next if File.directory?(file)
|
141
|
+
begin
|
142
|
+
puts "Loading: #{file}" if $DEBUG
|
143
|
+
load(file)
|
144
|
+
rescue LoadError
|
145
|
+
puts "Error loading: #{file}"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def prepare_tests_all
|
151
|
+
add_loadpath('lib/core','lib/lore','lib/more')
|
152
|
+
files = get_tests
|
153
|
+
run_tests(files)
|
154
|
+
end
|
155
|
+
|
156
|
+
def prepare_tests_core
|
157
|
+
add_loadpath('lib/core')
|
158
|
+
files = get_tests('core')
|
159
|
+
run_tests(files)
|
160
|
+
end
|
161
|
+
|
162
|
+
def prepare_tests_lore
|
163
|
+
add_loadpath('lib/lore')
|
164
|
+
files = get_tests('lore')
|
165
|
+
run_tests(files)
|
166
|
+
end
|
167
|
+
|
168
|
+
def prepare_tests_more
|
169
|
+
add_loadpath('lib/more')
|
170
|
+
files = get_tests('more')
|
171
|
+
run_tests(files)
|
3
172
|
end
|
4
173
|
|
174
|
+
#def run_tests
|
175
|
+
# live = ENV['live']
|
176
|
+
#
|
177
|
+
# unless live
|
178
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/core'))
|
179
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/lore'))
|
180
|
+
# $LOAD_PATH.unshift(File.expand_path('lib/more'))
|
181
|
+
# end
|
182
|
+
#
|
183
|
+
# puts "RUBY VERSION: #{RUBY_VERSION}"
|
184
|
+
# puts "LOAD PATH:\n" + $LOAD_PATH.join("\n")
|
185
|
+
#
|
186
|
+
# if find = ARGV[1..-1].select{|e| e !~ /(^[-]|[=])/ }[0]
|
187
|
+
# unless FileTest.file?(find)
|
188
|
+
# find = File.join(find, '**', 'test_*.rb')
|
189
|
+
# end
|
190
|
+
# else
|
191
|
+
# find = 'test/**/test_*.rb'
|
192
|
+
# end
|
193
|
+
#
|
194
|
+
# files = Dir.glob(find)
|
195
|
+
#
|
196
|
+
# files.each do |file|
|
197
|
+
# next if File.directory?(file)
|
198
|
+
# begin
|
199
|
+
# puts "Loading: #{file}" if $DEBUG
|
200
|
+
# load(file)
|
201
|
+
# rescue LoadError
|
202
|
+
# puts "Error loading: #{file}"
|
203
|
+
# end
|
204
|
+
# end
|
205
|
+
#end
|
206
|
+
|
207
|
+
#
|
208
|
+
# SETUP/INSTALL
|
209
|
+
# ----------------------------------------------------------------------------
|
210
|
+
|
211
|
+
def load_setup
|
212
|
+
begin
|
213
|
+
require 'setup'
|
214
|
+
$setup_installed = true
|
215
|
+
rescue LoadError
|
216
|
+
$setup_installed = false
|
217
|
+
puts "NOTP"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
private :load_setup
|
222
|
+
|
223
|
+
desc "install to ruby site location"
|
224
|
+
task :install do
|
225
|
+
load_setup
|
226
|
+
|
227
|
+
if $setup_installed
|
228
|
+
sh "setup.rb all"
|
229
|
+
else
|
230
|
+
puts "Requires stand-alone Setup.rb."
|
231
|
+
puts "See http://setup.rubyforge.org"
|
232
|
+
puts "or 'gem install setup'."
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
desc "uninstall from ruby site location"
|
237
|
+
task :uninstall do
|
238
|
+
load_setup
|
239
|
+
|
240
|
+
if $setup_installed
|
241
|
+
sh "setup.rb uninstall"
|
242
|
+
else
|
243
|
+
puts "Requires stand-alone Setup.rb."
|
244
|
+
puts "See http://setup.rubyforge.org"
|
245
|
+
puts "or 'gem install setup'."
|
246
|
+
end
|
247
|
+
end
|
data/TODO
ADDED
data/demo/hook.rd
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
= Hook Library
|
2
|
+
|
3
|
+
Require the hook.rb library.
|
4
|
+
|
5
|
+
require 'facets/hook'
|
6
|
+
|
7
|
+
Build a class with signals.
|
8
|
+
|
9
|
+
class X
|
10
|
+
include Hook
|
11
|
+
|
12
|
+
def course
|
13
|
+
@course ||= []
|
14
|
+
end
|
15
|
+
|
16
|
+
hook :signal
|
17
|
+
|
18
|
+
def boom(event, message)
|
19
|
+
course << "Kaboom!"
|
20
|
+
end
|
21
|
+
|
22
|
+
signal do |event, message|
|
23
|
+
course << ["1", event, message]
|
24
|
+
end
|
25
|
+
|
26
|
+
signal do |event, message|
|
27
|
+
course << ["2", event, message]
|
28
|
+
end
|
29
|
+
|
30
|
+
signal :boom
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
Triger the signal.
|
35
|
+
|
36
|
+
x = X.new
|
37
|
+
x.signal("hi")
|
38
|
+
|
39
|
+
The hooks should have been fired.
|
40
|
+
|
41
|
+
x.course[0].should == ["1", :signal, "hi"]
|
42
|
+
x.course[1].should == ["2", :signal, "hi"]
|
43
|
+
x.course[2].should == "Kaboom!"
|
44
|
+
x.course[3].should == nil
|
45
|
+
|
46
|
+
QED.
|
47
|
+
|