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