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
data/doc/ri/CLI/cdesc-CLI.yaml
CHANGED
@@ -4,8 +4,13 @@ attributes: []
|
|
4
4
|
class_methods: []
|
5
5
|
|
6
6
|
comment:
|
7
|
-
constants:
|
8
|
-
|
7
|
+
constants:
|
8
|
+
- !ruby/object:RI::Constant
|
9
|
+
comment:
|
10
|
+
- !ruby/struct:SM::Flow::P
|
11
|
+
body: Temporary backward compatability.
|
12
|
+
name: MasterCommand
|
13
|
+
value: Command
|
9
14
|
full_name: CLI
|
10
15
|
includes: []
|
11
16
|
|
@@ -4,7 +4,7 @@ aliases: []
|
|
4
4
|
block_params:
|
5
5
|
comment:
|
6
6
|
- !ruby/struct:SM::Flow::P
|
7
|
-
body: Generates a hash mapping each unique
|
7
|
+
body: Generates a hash mapping each unique element in the array to the relative frequency, i.e. the probablity, of it appearence.
|
8
8
|
- !ruby/struct:SM::Flow::VERB
|
9
9
|
body: " CREDIT: Brian Schr\xC3\xB6der\n"
|
10
10
|
full_name: Enumerable#probability
|
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:RI::MethodDescription
|
2
|
-
aliases:
|
3
|
-
|
2
|
+
aliases:
|
3
|
+
- !ruby/object:RI::AliasName
|
4
|
+
name: append_features_without_class_extension
|
4
5
|
block_params:
|
5
6
|
comment:
|
6
7
|
full_name: Module#append_features
|
7
8
|
is_singleton: false
|
8
9
|
name: append_features
|
9
|
-
params: (
|
10
|
+
params: ( base )
|
10
11
|
visibility: public
|
@@ -9,9 +9,8 @@ comment: []
|
|
9
9
|
constants: []
|
10
10
|
|
11
11
|
full_name: Module
|
12
|
-
includes:
|
13
|
-
|
14
|
-
name: CloneExtensions
|
12
|
+
includes: []
|
13
|
+
|
15
14
|
instance_methods:
|
16
15
|
- !ruby/object:RI::MethodSummary
|
17
16
|
name: "*"
|
@@ -135,6 +134,8 @@ instance_methods:
|
|
135
134
|
name: method_overloads
|
136
135
|
- !ruby/object:RI::MethodSummary
|
137
136
|
name: method_space
|
137
|
+
- !ruby/object:RI::MethodSummary
|
138
|
+
name: methodize
|
138
139
|
- !ruby/object:RI::MethodSummary
|
139
140
|
name: mixin_parameters
|
140
141
|
- !ruby/object:RI::MethodSummary
|
@@ -0,0 +1,14 @@
|
|
1
|
+
--- !ruby/object:RI::MethodDescription
|
2
|
+
aliases: []
|
3
|
+
|
4
|
+
block_params:
|
5
|
+
comment:
|
6
|
+
- !ruby/struct:SM::Flow::P
|
7
|
+
body: Translate a module name to a suitable method name.
|
8
|
+
- !ruby/struct:SM::Flow::VERB
|
9
|
+
body: " My::CoolClass.methodize => "my__cool_class"\n"
|
10
|
+
full_name: Module#methodize
|
11
|
+
is_singleton: false
|
12
|
+
name: methodize
|
13
|
+
params: ()
|
14
|
+
visibility: public
|
@@ -9,7 +9,7 @@ comment:
|
|
9
9
|
- !ruby/struct:SM::Flow::P
|
10
10
|
body: If <em>aka</em> is given, then the method being redefined will first be aliased to this name.
|
11
11
|
- !ruby/struct:SM::Flow::VERB
|
12
|
-
body: " class Greeter\n def hello ; "Hello" ; end\n end\n\n Greeter.new.hello #=> "Hello"\n\n class Greeter\n redefine_method( :hello, :hi ) do\n hi + ", friend!"\n end\n end\n\n Greeter.new.hello #=> "Hello, friend!"\n\n
|
12
|
+
body: " class Greeter\n def hello ; "Hello" ; end\n end\n\n Greeter.new.hello #=> "Hello"\n\n class Greeter\n redefine_method( :hello, :hi ) do\n hi + ", friend!"\n end\n end\n\n Greeter.new.hello #=> "Hello, friend!"\n\n CREDIT: Trans\n"
|
13
13
|
full_name: Module#redefine_method
|
14
14
|
is_singleton: false
|
15
15
|
name: redefine_method
|
@@ -11,7 +11,9 @@ comment:
|
|
11
11
|
- !ruby/struct:SM::Flow::P
|
12
12
|
body: "The above class definition is equivalent to:"
|
13
13
|
- !ruby/struct:SM::Flow::VERB
|
14
|
-
body: " class Example\n def hi(*args)\n hello(*args)\n end\n def hey(*args)\n hello(*args)\n end\n def hello\n puts "Hello"\n end\n end\n
|
14
|
+
body: " class Example\n def hi(*args)\n hello(*args)\n end\n def hey(*args)\n hello(*args)\n end\n def hello\n puts "Hello"\n end\n end\n"
|
15
|
+
- !ruby/struct:SM::Flow::P
|
16
|
+
body: "CREDIT: Trans"
|
15
17
|
full_name: Module#redirect_method
|
16
18
|
is_singleton: false
|
17
19
|
name: redirect_method
|
@@ -7,7 +7,7 @@ comment:
|
|
7
7
|
- !ruby/struct:SM::Flow::P
|
8
8
|
body: Aliases a method and undefines the original.
|
9
9
|
- !ruby/struct:SM::Flow::VERB
|
10
|
-
body: " rename_method( :to_method, :from_method )\n\n
|
10
|
+
body: " rename_method( :to_method, :from_method )\n\n CREDIT: Trans\n"
|
11
11
|
full_name: Module#rename_method
|
12
12
|
is_singleton: false
|
13
13
|
name: rename_method
|
data/doc/ri/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Wed, 13 Aug 2008 19:26:46 -0400
|
data/lib/core/facets/array.rb
CHANGED
@@ -10,14 +10,17 @@
|
|
10
10
|
require 'facets/array/combination.rb'
|
11
11
|
require 'facets/array/conjoin.rb'
|
12
12
|
require 'facets/array/delete.rb'
|
13
|
+
require 'facets/array/indexable.rb'
|
13
14
|
require 'facets/array/merge.rb'
|
14
15
|
require 'facets/array/not_empty'
|
15
16
|
require 'facets/array/only'
|
16
17
|
require 'facets/array/pad.rb'
|
17
18
|
require 'facets/array/permutation.rb'
|
18
19
|
require 'facets/array/product.rb'
|
20
|
+
require 'facets/array/recursively.rb'
|
19
21
|
require 'facets/array/rotate.rb'
|
20
22
|
require 'facets/array/select.rb'
|
21
23
|
require 'facets/array/splice.rb'
|
24
|
+
require 'facets/array/stackable.rb'
|
22
25
|
require 'facets/array/traverse.rb'
|
23
26
|
|
data/lib/core/facets/binding.rb
CHANGED
data/lib/core/facets/class.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'facets/class/descendents'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
require 'facets/class/prepend'
|
3
|
+
require 'facets/class/subclasses'
|
4
|
+
require 'facets/class/methodize'
|
5
|
+
require 'facets/class/pathize'
|
6
6
|
require 'facets/class/to_proc'
|
7
7
|
|
@@ -1,11 +1,14 @@
|
|
1
|
+
require 'facets/string/methodize'
|
2
|
+
|
1
3
|
class Class
|
2
4
|
|
3
5
|
# Translate a class name to a suitable method name.
|
4
6
|
#
|
5
7
|
# My::CoolClass.methodize => "my__cool_class"
|
6
8
|
#
|
7
|
-
def
|
8
|
-
name.
|
9
|
+
def methodize
|
10
|
+
name.methodize
|
9
11
|
end
|
10
12
|
|
11
13
|
end
|
14
|
+
|
@@ -1,20 +1,23 @@
|
|
1
1
|
require 'facets/enumerable/accumulate.rb'
|
2
2
|
require 'facets/enumerable/cluster_by.rb'
|
3
3
|
require 'facets/enumerable/collect.rb'
|
4
|
+
require 'facets/enumerable/commonality.rb'
|
4
5
|
require 'facets/enumerable/count.rb'
|
5
6
|
require 'facets/enumerable/divide.rb'
|
6
7
|
require 'facets/enumerable/duplicates.rb'
|
7
8
|
require 'facets/enumerable/each_by.rb'
|
9
|
+
require 'facets/enumerable/entropy.rb'
|
10
|
+
require 'facets/enumerable/frequency.rb'
|
8
11
|
require 'facets/enumerable/group_by.rb'
|
9
12
|
require 'facets/enumerable/inject.rb'
|
10
|
-
require 'facets/enumerable/mash.rb'
|
11
13
|
require 'facets/enumerable/map_send.rb'
|
14
|
+
require 'facets/enumerable/mash.rb'
|
12
15
|
require 'facets/enumerable/mode.rb'
|
13
16
|
require 'facets/enumerable/modulate.rb'
|
17
|
+
require 'facets/enumerable/probability.rb'
|
14
18
|
require 'facets/enumerable/none.rb'
|
15
19
|
require 'facets/enumerable/occur.rb'
|
16
20
|
require 'facets/enumerable/one.rb'
|
17
|
-
#require 'facets/enumerable/probablity.rb'
|
18
21
|
require 'facets/enumerable/split.rb'
|
19
22
|
require 'facets/enumerable/sum.rb'
|
20
23
|
require 'facets/enumerable/uniq_by.rb'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Enumerable
|
2
|
+
|
3
|
+
# Returns all items that are equal in terms of the supplied block.
|
4
|
+
# If no block is given objects are considered to be equal if they
|
5
|
+
# return the same value for Object#hash and if obj1 == obj2.
|
6
|
+
#
|
7
|
+
# [1, 2, 2, 3, 4, 4].commonality # => { 2 => [2], 4 => [4] }
|
8
|
+
#
|
9
|
+
# ["foo", "bar", "a"].commonality { |str| str.length }
|
10
|
+
# # => { 3 => ["foo, "bar"] }
|
11
|
+
#
|
12
|
+
# # Returns all persons that share their last name with another person.
|
13
|
+
# persons.collisions { |person| person.last_name }
|
14
|
+
#
|
15
|
+
# CREDIT: Florian Gross
|
16
|
+
|
17
|
+
def commonality( &block )
|
18
|
+
had_no_block = !block
|
19
|
+
block ||= lambda { |item| item }
|
20
|
+
result = Hash.new { |hash, key| hash[key] = Array.new }
|
21
|
+
self.each do |item|
|
22
|
+
key = block.call(item)
|
23
|
+
result[key] << item
|
24
|
+
end
|
25
|
+
result.reject! do |key, values|
|
26
|
+
values.size <= 1
|
27
|
+
end
|
28
|
+
#return had_no_block ? result.values.flatten : result
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'facets/enumerable/probability'
|
2
|
+
|
3
|
+
module Enumerable
|
4
|
+
|
5
|
+
# Shannon's entropy for an array - returns the average
|
6
|
+
# bits per symbol required to encode the array.
|
7
|
+
# Lower values mean less "entropy" - i.e. less unique
|
8
|
+
# information in the array.
|
9
|
+
#
|
10
|
+
# %w{ a b c d e e e }.entropy #=>
|
11
|
+
#
|
12
|
+
# CREDIT: Derek
|
13
|
+
|
14
|
+
def entropy
|
15
|
+
arr = to_a
|
16
|
+
probHash = arr.probability
|
17
|
+
# h is the Shannon entropy of the array
|
18
|
+
h = -1.to_f * probHash.keys.inject(0.to_f) do |sum, i|
|
19
|
+
sum + (probHash[i] * (Math.log(probHash[i])/Math.log(2.to_f)))
|
20
|
+
end
|
21
|
+
h
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns the maximum possible Shannon entropy of the array
|
25
|
+
# with given size assuming that it is an "order-0" source
|
26
|
+
# (each element is selected independently of the next).
|
27
|
+
#
|
28
|
+
# CREDIT: Derek
|
29
|
+
|
30
|
+
def ideal_entropy
|
31
|
+
arr = to_a
|
32
|
+
unitProb = 1.0.to_f / arr.size.to_f
|
33
|
+
(-1.to_f * arr.size.to_f * unitProb * Math.log(unitProb)/Math.log(2.to_f))
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Enumerable
|
2
|
+
|
3
|
+
# Generates a hash mapping each unique symbol in the array
|
4
|
+
# to the absolute frequency it appears.
|
5
|
+
#
|
6
|
+
# CREDIT: Brian Schröder
|
7
|
+
|
8
|
+
def frequency
|
9
|
+
#probs = Hash.new(0)
|
10
|
+
#each do |e|
|
11
|
+
# probs[e] += 1
|
12
|
+
#end
|
13
|
+
#probs
|
14
|
+
inject(Hash.new(0)){|h,v| h[v]+=1; h}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Enumerable
|
2
2
|
|
3
|
-
# Generates a hash mapping each unique
|
3
|
+
# Generates a hash mapping each unique element in the array
|
4
4
|
# to the relative frequency, i.e. the probablity, of
|
5
5
|
# it appearence.
|
6
6
|
#
|
@@ -32,102 +32,5 @@ module Enumerable
|
|
32
32
|
# probHash
|
33
33
|
# end
|
34
34
|
|
35
|
-
# Shannon's entropy for an array - returns the average
|
36
|
-
# bits per symbol required to encode the array.
|
37
|
-
# Lower values mean less "entropy" - i.e. less unique
|
38
|
-
# information in the array.
|
39
|
-
#
|
40
|
-
# %w{ a b c d e e e }.entropy #=>
|
41
|
-
#
|
42
|
-
# CREDIT: Derek
|
43
|
-
|
44
|
-
def entropy
|
45
|
-
arr = to_a
|
46
|
-
probHash = arr.probability
|
47
|
-
# h is the Shannon entropy of the array
|
48
|
-
h = -1.to_f * probHash.keys.inject(0.to_f) do |sum, i|
|
49
|
-
sum + (probHash[i] * (Math.log(probHash[i])/Math.log(2.to_f)))
|
50
|
-
end
|
51
|
-
h
|
52
|
-
end
|
53
|
-
|
54
|
-
# Returns the maximum possible Shannon entropy of the array
|
55
|
-
# with given size assuming that it is an "order-0" source
|
56
|
-
# (each element is selected independently of the next).
|
57
|
-
#
|
58
|
-
# CREDIT: Derek
|
59
|
-
|
60
|
-
def ideal_entropy
|
61
|
-
arr = to_a
|
62
|
-
unitProb = 1.0.to_f / arr.size.to_f
|
63
|
-
(-1.to_f * arr.size.to_f * unitProb * Math.log(unitProb)/Math.log(2.to_f))
|
64
|
-
end
|
65
|
-
|
66
|
-
# Generates a hash mapping each unique symbol in the array
|
67
|
-
# to the absolute frequency it appears.
|
68
|
-
#
|
69
|
-
# CREDIT: Brian Schröder
|
70
|
-
|
71
|
-
def frequency
|
72
|
-
#probs = Hash.new(0)
|
73
|
-
#each do |e|
|
74
|
-
# probs[e] += 1
|
75
|
-
#end
|
76
|
-
#probs
|
77
|
-
inject(Hash.new(0)){|h,v| h[v]+=1; h}
|
78
|
-
end
|
79
|
-
|
80
|
-
# Returns all items that are equal in terms of the supplied block.
|
81
|
-
# If no block is given objects are considered to be equal if they
|
82
|
-
# return the same value for Object#hash and if obj1 == obj2.
|
83
|
-
#
|
84
|
-
# [1, 2, 2, 3, 4, 4].commonality # => { 2 => [2], 4 => [4] }
|
85
|
-
#
|
86
|
-
# ["foo", "bar", "a"].commonality { |str| str.length }
|
87
|
-
# # => { 3 => ["foo, "bar"] }
|
88
|
-
#
|
89
|
-
# # Returns all persons that share their last name with another person.
|
90
|
-
# persons.collisions { |person| person.last_name }
|
91
|
-
#
|
92
|
-
# CREDIT: Florian Gross
|
93
|
-
|
94
|
-
def commonality( &block )
|
95
|
-
had_no_block = !block
|
96
|
-
block ||= lambda { |item| item }
|
97
|
-
result = Hash.new { |hash, key| hash[key] = Array.new }
|
98
|
-
self.each do |item|
|
99
|
-
key = block.call(item)
|
100
|
-
result[key] << item
|
101
|
-
end
|
102
|
-
result.reject! do |key, values|
|
103
|
-
values.size <= 1
|
104
|
-
end
|
105
|
-
#return had_no_block ? result.values.flatten : result
|
106
|
-
return result
|
107
|
-
end
|
108
|
-
|
109
|
-
# Like commonality but returns an array of duplicates.
|
110
|
-
|
111
|
-
#def collisions(&blk) #:yield:
|
112
|
-
# a = []
|
113
|
-
# commonality(&blk).each{ |k,v| a.concat(v) }
|
114
|
-
# a.uniq
|
115
|
-
#end
|
116
|
-
|
117
35
|
end
|
118
36
|
|
119
|
-
|
120
|
-
# class String
|
121
|
-
#
|
122
|
-
# NOTE: String#entropy has been deprecated.
|
123
|
-
# Use str.chars.entropy instead.
|
124
|
-
# def entropy
|
125
|
-
# split(//).entropy
|
126
|
-
# end
|
127
|
-
#
|
128
|
-
# # Not needed b/c ideal_entropy is only dependent on size.
|
129
|
-
# # def ideal_entropy
|
130
|
-
# # self.split(//).ideal_entropy
|
131
|
-
# # end
|
132
|
-
#
|
133
|
-
# end
|
data/lib/core/facets/file.rb
CHANGED
data/lib/core/facets/hash.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'facets/hash/alias.rb'
|
1
2
|
require 'facets/hash/argumentize.rb'
|
2
3
|
require 'facets/hash/at.rb'
|
3
4
|
require 'facets/hash/autonew.rb'
|
@@ -12,12 +13,17 @@ require 'facets/hash/keys.rb'
|
|
12
13
|
require 'facets/hash/mash.rb'
|
13
14
|
require 'facets/hash/merge.rb'
|
14
15
|
require 'facets/hash/op.rb'
|
16
|
+
require 'facets/hash/recursive_merge.rb'
|
17
|
+
require 'facets/hash/recursively.rb'
|
15
18
|
require 'facets/hash/rekey.rb'
|
16
19
|
require 'facets/hash/select.rb'
|
17
20
|
require 'facets/hash/slice.rb'
|
21
|
+
require 'facets/hash/swap.rb'
|
22
|
+
require 'facets/hash/to_h.rb'
|
18
23
|
require 'facets/hash/to_proc.rb'
|
19
24
|
require 'facets/hash/to_struct.rb'
|
20
25
|
require 'facets/hash/traverse.rb'
|
21
26
|
require 'facets/hash/update.rb'
|
27
|
+
require 'facets/hash/weave.rb'
|
22
28
|
require 'facets/hash/zipnew.rb'
|
23
29
|
|