facets 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -1
- data/CHANGES +28 -45
- data/MANIFEST +35 -4
- data/README +3 -14
- data/RELEASE +36 -70
- data/VERSION +1 -1
- data/doc/archive/RELEASE-2.5.0 +83 -0
- data/doc/log/basic_stats/index.html +4 -4
- data/doc/log/changelog.html +509 -2
- data/doc/log/changelog.txt +130 -1522
- data/doc/rdoc/core/classes/Array.html +366 -141
- data/doc/rdoc/core/classes/Binding.html +45 -45
- data/doc/rdoc/core/classes/Class.html +38 -38
- data/doc/rdoc/core/classes/Comparable.html +26 -26
- data/doc/rdoc/core/classes/Enumerable.html +174 -170
- data/doc/rdoc/core/classes/Enumerable/Enumerator.html +130 -0
- data/doc/rdoc/core/classes/Enumerator.html +132 -0
- data/doc/rdoc/core/classes/Exception.html +8 -8
- data/doc/rdoc/core/classes/File.html +58 -58
- data/doc/rdoc/core/classes/FileTest.html +4 -4
- data/doc/rdoc/core/classes/Float.html +8 -8
- data/doc/rdoc/core/classes/Functor.html +12 -12
- data/doc/rdoc/core/classes/Hash.html +447 -263
- data/doc/rdoc/core/classes/Indexable.html +110 -110
- data/doc/rdoc/core/classes/Integer.html +2 -2
- data/doc/rdoc/core/classes/Kernel.html +329 -329
- data/doc/rdoc/core/classes/Lazy/Promise.html +1 -1
- data/doc/rdoc/core/classes/MatchData.html +15 -15
- data/doc/rdoc/core/classes/Module.html +176 -157
- data/doc/rdoc/core/classes/NilClass.html +23 -23
- data/doc/rdoc/core/classes/Numeric.html +27 -27
- data/doc/rdoc/core/classes/Object.html +8 -8
- data/doc/rdoc/core/classes/ObjectSpace.html +5 -5
- data/doc/rdoc/core/classes/Proc.html +22 -22
- data/doc/rdoc/core/classes/Regexp.html +1 -1
- data/doc/rdoc/core/classes/Stackable.html +31 -31
- data/doc/rdoc/core/classes/String.html +332 -291
- data/doc/rdoc/core/classes/Symbol.html +1 -1
- data/doc/rdoc/core/classes/TrueClass.html +8 -8
- data/doc/rdoc/core/classes/UnboundMethod.html +18 -13
- data/doc/rdoc/core/created.rid +1 -1
- data/doc/rdoc/core/files/README.html +7 -29
- data/doc/rdoc/core/files/lib/core/facets/array/product_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/collect_rb.html +10 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/compact_map_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/enumerable/map_with_index_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/enumerable/split_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/collate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/group_by_value_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/hash/new_with_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/module/conflict_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/extend_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/string/align_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/file_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/string/xor_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +5 -1
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/name_rb.html +1 -1
- data/doc/rdoc/core/fr_class_index.html +2 -0
- data/doc/rdoc/core/fr_file_index.html +6 -0
- data/doc/rdoc/core/fr_method_index.html +386 -373
- data/doc/rdoc/lore/classes/OpenStruct.html +6 -4
- data/doc/rdoc/lore/created.rid +1 -1
- data/doc/rdoc/lore/files/README.html +7 -29
- data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +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 +67 -53
- data/doc/rdoc/more/classes/Association/Kernel.html +11 -12
- data/doc/rdoc/more/classes/BBCode.html +36 -36
- data/doc/rdoc/more/classes/BaseX.html +16 -16
- data/doc/rdoc/more/classes/BiCrypt.html +67 -67
- 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 +8 -8
- data/doc/rdoc/more/classes/Buildable.html +4 -4
- data/doc/rdoc/more/classes/Cloneable.html +4 -4
- data/doc/rdoc/more/classes/ConsoleUtils.html +18 -18
- data/doc/rdoc/more/classes/Crypt.html +16 -16
- data/doc/rdoc/more/classes/CssTree.html +8 -8
- data/doc/rdoc/more/classes/Dictionary.html +52 -45
- data/doc/rdoc/more/classes/Enumerable.html +50 -50
- 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/Enumerable/Filterable.html +30 -30
- data/doc/rdoc/more/classes/EnumerablePass.html +15 -15
- data/doc/rdoc/more/classes/Equatable.html +16 -16
- data/doc/rdoc/more/classes/Expirable.html +17 -17
- data/doc/rdoc/more/classes/Fileable.html +14 -14
- data/doc/rdoc/more/classes/Fileable/DSL.html +41 -41
- data/doc/rdoc/more/classes/Hash2Xml.html +4 -4
- data/doc/rdoc/more/classes/Hook.html +162 -0
- data/doc/rdoc/more/classes/HtmlFilter.html +9 -9
- data/doc/rdoc/more/classes/Instantiable.html +9 -9
- data/doc/rdoc/more/classes/Instantize.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/Matcher.html +38 -38
- data/doc/rdoc/more/classes/Matcher/MatchData.html +4 -4
- data/doc/rdoc/more/classes/Memoizer.html +21 -21
- 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 +8 -8
- data/doc/rdoc/more/classes/OpEsc.html +5 -5
- data/doc/rdoc/more/classes/OpenCascade.html +4 -4
- data/doc/rdoc/more/classes/OpenHash.html +9 -9
- data/doc/rdoc/more/classes/OpenStructable.html +36 -36
- data/doc/rdoc/more/classes/PQueue.html +84 -84
- data/doc/rdoc/more/classes/Paramix.html +16 -16
- data/doc/rdoc/more/classes/Paramix/Delegator.html +16 -16
- data/doc/rdoc/more/classes/RWDelegator.html +16 -16
- data/doc/rdoc/more/classes/Random.html +5 -5
- 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/Registerable.html +13 -13
- data/doc/rdoc/more/classes/Stash.html +28 -28
- data/doc/rdoc/more/classes/String/Mask.html +72 -72
- data/doc/rdoc/more/classes/String/Words.html +31 -31
- 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/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/X.html +117 -0
- data/doc/rdoc/more/classes/XOXO.html +11 -11
- data/doc/rdoc/more/classes/ZipUtils.html +88 -88
- data/doc/rdoc/more/classes/ZipUtils/DryRun.html +68 -68
- data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +68 -68
- data/doc/rdoc/more/classes/ZipUtils/Verbose.html +60 -60
- data/doc/rdoc/more/created.rid +1 -1
- data/doc/rdoc/more/files/README.html +7 -29
- data/doc/rdoc/more/files/lib/more/facets/association_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/dictionary_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/hook_rb.html +96 -0
- data/doc/rdoc/more/files/lib/more/facets/paramix_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/xoxo_rb.html +2 -2
- data/doc/rdoc/more/fr_class_index.html +2 -0
- data/doc/rdoc/more/fr_file_index.html +1 -0
- data/doc/rdoc/more/fr_method_index.html +686 -681
- data/lib/core/facets/array/product.rb +6 -23
- data/lib/core/facets/enumerable/collect.rb +3 -53
- data/lib/core/facets/enumerable/compact_map.rb +35 -0
- data/lib/core/facets/enumerable/map_with_index.rb +23 -0
- data/lib/core/facets/enumerable/split.rb +3 -3
- data/lib/core/facets/hash/collate.rb +45 -14
- data/lib/core/facets/hash/group_by_value.rb +65 -0
- data/lib/core/facets/hash/new_with.rb +15 -0
- data/lib/core/facets/module/extend.rb +11 -0
- data/lib/core/facets/string/align.rb +19 -18
- data/lib/core/facets/string/file.rb +17 -0
- data/lib/core/facets/string/xor.rb +9 -3
- data/lib/core/facets/to_hash.rb +274 -17
- data/lib/core/facets/unboundmethod/name.rb +4 -2
- data/lib/lore/facets/ostruct.rb +3 -0
- data/lib/more/facets/association.rb +28 -12
- data/lib/more/facets/dictionary.rb +10 -4
- data/lib/more/facets/hook.rb +65 -0
- data/lib/more/facets/paramix.rb +5 -5
- data/meta/abstract +13 -0
- data/meta/authors +1 -0
- data/meta/contact +1 -0
- data/meta/contributors +48 -0
- data/meta/created +1 -0
- data/meta/homepage +1 -0
- data/meta/license +1 -0
- data/meta/loadpath +3 -0
- data/meta/releases +14 -0
- data/meta/slogan +1 -0
- data/meta/summary +1 -0
- data/task/test.rake +116 -18
- data/test/core/array/test_product.rb +0 -6
- data/test/core/binding/test_local_variables.rb +9 -3
- data/test/core/enumerable/test_split.rb +19 -0
- data/test/core/module/test_conflict.rb +8 -3
- data/test/core/test_to_hash.rb +152 -0
- data/test/core/unboundmethod/test_arguments.rb +1 -1
- data/test/core/unboundmethod/test_name.rb +2 -2
- metadata +39 -8
- data/doc/log/bstats/stats.html +0 -39
- data/doc/log/stats.html +0 -25
- data/test/more/test_to_hash.rb +0 -58
@@ -66,7 +66,6 @@
|
|
66
66
|
<a href="../files/lib/core/facets/enumerable/mode_rb.html">lib/core/facets/enumerable/mode.rb</a>
|
67
67
|
<a href="../files/lib/core/facets/enumerable/commonality_rb.html">lib/core/facets/enumerable/commonality.rb</a>
|
68
68
|
<a href="../files/lib/core/facets/enumerable/occur_rb.html">lib/core/facets/enumerable/occur.rb</a>
|
69
|
-
<a href="../files/lib/core/facets/enumerable/collect_rb.html">lib/core/facets/enumerable/collect.rb</a>
|
70
69
|
<a href="../files/lib/core/facets/enumerable/frequency_rb.html">lib/core/facets/enumerable/frequency.rb</a>
|
71
70
|
<a href="../files/lib/core/facets/enumerable/divide_rb.html">lib/core/facets/enumerable/divide.rb</a>
|
72
71
|
<a href="../files/lib/core/facets/enumerable/inject_rb.html">lib/core/facets/enumerable/inject.rb</a>
|
@@ -80,8 +79,10 @@
|
|
80
79
|
<a href="../files/lib/core/facets/enumerable/split_rb.html">lib/core/facets/enumerable/split.rb</a>
|
81
80
|
<a href="../files/lib/core/facets/enumerable/map_send_rb.html">lib/core/facets/enumerable/map_send.rb</a>
|
82
81
|
<a href="../files/lib/core/facets/enumerable/probability_rb.html">lib/core/facets/enumerable/probability.rb</a>
|
82
|
+
<a href="../files/lib/core/facets/enumerable/map_with_index_rb.html">lib/core/facets/enumerable/map_with_index.rb</a>
|
83
83
|
<a href="../files/lib/core/facets/enumerable/count_rb.html">lib/core/facets/enumerable/count.rb</a>
|
84
84
|
<a href="../files/lib/core/facets/enumerable/each_by_rb.html">lib/core/facets/enumerable/each_by.rb</a>
|
85
|
+
<a href="../files/lib/core/facets/enumerable/compact_map_rb.html">lib/core/facets/enumerable/compact_map.rb</a>
|
85
86
|
</td>
|
86
87
|
</tr>
|
87
88
|
</table>
|
@@ -97,47 +98,50 @@
|
|
97
98
|
|
98
99
|
|
99
100
|
<div class="sectiontitle">Methods</div>
|
100
|
-
<span style="padding-right: 5px;"><a href="#
|
101
|
-
<span style="padding-right: 5px;"><a href="#
|
102
|
-
<span style="padding-right: 5px;"><a href="#
|
103
|
-
<span style="padding-right: 5px;"><a href="#
|
104
|
-
<span style="padding-right: 5px;"><a href="#
|
105
|
-
<span style="padding-right: 5px;"><a href="#
|
106
|
-
<span style="padding-right: 5px;"><a href="#
|
107
|
-
<span style="padding-right: 5px;"><a href="#
|
108
|
-
<span style="padding-right: 5px;"><a href="#
|
109
|
-
<span style="padding-right: 5px;"><a href="#
|
110
|
-
<span style="padding-right: 5px;"><a href="#
|
111
|
-
<span style="padding-right: 5px;"><a href="#
|
112
|
-
<span style="padding-right: 5px;"><a href="#
|
113
|
-
<span style="padding-right: 5px;"><a href="#
|
114
|
-
<span style="padding-right: 5px;"><a href="#
|
115
|
-
<span style="padding-right: 5px;"><a href="#
|
116
|
-
<span style="padding-right: 5px;"><a href="#
|
117
|
-
<span style="padding-right: 5px;"><a href="#
|
118
|
-
<span style="padding-right: 5px;"><a href="#
|
119
|
-
<span style="padding-right: 5px;"><a href="#
|
120
|
-
<span style="padding-right: 5px;"><a href="#
|
121
|
-
<span style="padding-right: 5px;"><a href="#
|
122
|
-
<span style="padding-right: 5px;"><a href="#
|
123
|
-
<span style="padding-right: 5px;"><a href="#
|
124
|
-
<span style="padding-right: 5px;"><a href="#
|
125
|
-
<span style="padding-right: 5px;"><a href="#
|
126
|
-
<span style="padding-right: 5px;"><a href="#
|
127
|
-
<span style="padding-right: 5px;"><a href="#
|
128
|
-
<span style="padding-right: 5px;"><a href="#
|
129
|
-
<span style="padding-right: 5px;"><a href="#
|
130
|
-
<span style="padding-right: 5px;"><a href="#
|
101
|
+
<span style="padding-right: 5px;"><a href="#M000443">accumulate</a></span>
|
102
|
+
<span style="padding-right: 5px;"><a href="#M000430">cluster_by</a></span>
|
103
|
+
<span style="padding-right: 5px;"><a href="#M000453">collect_with_index</a></span>
|
104
|
+
<span style="padding-right: 5px;"><a href="#M000434">commonality</a></span>
|
105
|
+
<span style="padding-right: 5px;"><a href="#M000457">compact_collect</a></span>
|
106
|
+
<span style="padding-right: 5px;"><a href="#M000456">compact_map</a></span>
|
107
|
+
<span style="padding-right: 5px;"><a href="#M000454">count</a></span>
|
108
|
+
<span style="padding-right: 5px;"><a href="#M000437">divide</a></span>
|
109
|
+
<span style="padding-right: 5px;"><a href="#M000440">duplicates</a></span>
|
110
|
+
<span style="padding-right: 5px;"><a href="#M000455">each_by</a></span>
|
111
|
+
<span style="padding-right: 5px;"><a href="#M000447">entropy</a></span>
|
112
|
+
<span style="padding-right: 5px;"><a href="#M000436">frequency</a></span>
|
113
|
+
<span style="padding-right: 5px;"><a href="#M000445">graph</a></span>
|
114
|
+
<span style="padding-right: 5px;"><a href="#M000431">group_by</a></span>
|
115
|
+
<span style="padding-right: 5px;"><a href="#M000448">ideal_entropy</a></span>
|
116
|
+
<span style="padding-right: 5px;"><a href="#M000438">inject!</a></span>
|
117
|
+
<span style="padding-right: 5px;"><a href="#M000450">map_send</a></span>
|
118
|
+
<span style="padding-right: 5px;"><a href="#M000452">map_with_index</a></span>
|
119
|
+
<span style="padding-right: 5px;"><a href="#M000444">mash</a></span>
|
120
|
+
<span style="padding-right: 5px;"><a href="#M000433">mode</a></span>
|
121
|
+
<span style="padding-right: 5px;"><a href="#M000446">modulate</a></span>
|
122
|
+
<span style="padding-right: 5px;"><a href="#M000441">none?</a></span>
|
123
|
+
<span style="padding-right: 5px;"><a href="#M000439">nonuniq</a></span>
|
124
|
+
<span style="padding-right: 5px;"><a href="#M000435">occur</a></span>
|
125
|
+
<span style="padding-right: 5px;"><a href="#M000429">one?</a></span>
|
126
|
+
<span style="padding-right: 5px;"><a href="#M000451">probability</a></span>
|
127
|
+
<span style="padding-right: 5px;"><a href="#M000449">split</a></span>
|
128
|
+
<span style="padding-right: 5px;"><a href="#M000432">sum</a></span>
|
129
|
+
<span style="padding-right: 5px;"><a href="#M000428">take</a></span>
|
130
|
+
<span style="padding-right: 5px;"><a href="#M000427">to_h</a></span>
|
131
|
+
<span style="padding-right: 5px;"><a href="#M000442">uniq_by</a></span>
|
131
132
|
|
132
133
|
|
133
134
|
|
135
|
+
<div class="sectiontitle">Classes and Modules</div>
|
136
|
+
Class <a href="Enumerable/Enumerator.html" class="link">Enumerable::Enumerator</a><br />
|
137
|
+
|
134
138
|
|
135
139
|
|
136
140
|
|
137
141
|
<div class="sectiontitle">Public Instance methods</div>
|
138
142
|
<div class="method">
|
139
143
|
<div class="title">
|
140
|
-
<a name="
|
144
|
+
<a name="M000443"></a><b>accumulate</b>()
|
141
145
|
</div>
|
142
146
|
<div class="description">
|
143
147
|
<p>
|
@@ -157,8 +161,8 @@ CREDIT: George Moshchovitis
|
|
157
161
|
</p>
|
158
162
|
</div>
|
159
163
|
<div class="sourcecode">
|
160
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
161
|
-
<div id="
|
164
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000443_source')" id="l_M000443_source">+</a> ]</p>
|
165
|
+
<div id="M000443_source" class="dyn-source">
|
162
166
|
<pre>
|
163
167
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/accumulate.rb, line 16</span>
|
164
168
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">accumulate</span>
|
@@ -172,11 +176,11 @@ CREDIT: George Moshchovitis
|
|
172
176
|
</div>
|
173
177
|
<div class="method">
|
174
178
|
<div class="title">
|
175
|
-
<a name="
|
179
|
+
<a name="M000430"></a><b>cluster_by</b>(&b)
|
176
180
|
</div>
|
177
181
|
<div class="description">
|
178
182
|
<p>
|
179
|
-
Similar to <a href="Enumerable.html#
|
183
|
+
Similar to <a href="Enumerable.html#M000431">group_by</a> but returns an
|
180
184
|
array of the groups. Returned elements are sorted by block.
|
181
185
|
</p>
|
182
186
|
<pre>
|
@@ -193,8 +197,8 @@ CREDIT: Erik Veenstra
|
|
193
197
|
</p>
|
194
198
|
</div>
|
195
199
|
<div class="sourcecode">
|
196
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
197
|
-
<div id="
|
200
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000430_source')" id="l_M000430_source">+</a> ]</p>
|
201
|
+
<div id="M000430_source" class="dyn-source">
|
198
202
|
<pre>
|
199
203
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/cluster_by.rb, line 16</span>
|
200
204
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cluster_by</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
@@ -206,43 +210,17 @@ CREDIT: Erik Veenstra
|
|
206
210
|
</div>
|
207
211
|
<div class="method">
|
208
212
|
<div class="title">
|
209
|
-
<a name="
|
213
|
+
<a name="M000453"></a><b>collect_with_index</b>()
|
210
214
|
</div>
|
211
215
|
<div class="description">
|
212
216
|
<p>
|
213
|
-
|
214
|
-
</p>
|
215
|
-
<pre>
|
216
|
-
a = [1,2,3].collect_with_index { |e,i| e*i }
|
217
|
-
a #=> [0,2,6]
|
218
|
-
</pre>
|
219
|
-
<p>
|
220
|
-
CREDIT: Gavin Sinclair
|
217
|
+
Alias for <a href="Enumerable.html#M000452">map_with_index</a>
|
221
218
|
</p>
|
222
219
|
</div>
|
223
|
-
<div class="aka">
|
224
|
-
This method is also aliased as
|
225
|
-
<a href="Enumerable.html#M000425">map_with_index</a>
|
226
|
-
</div>
|
227
|
-
<div class="sourcecode">
|
228
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000424_source')" id="l_M000424_source">+</a> ]</p>
|
229
|
-
<div id="M000424_source" class="dyn-source">
|
230
|
-
<pre>
|
231
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/collect.rb, line 10</span>
|
232
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">collect_with_index</span>
|
233
|
-
<span class="ruby-identifier">r</span> = []
|
234
|
-
<span class="ruby-identifier">each_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
235
|
-
<span class="ruby-identifier">r</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>], <span class="ruby-identifier">i</span>)
|
236
|
-
<span class="ruby-keyword kw">end</span>
|
237
|
-
<span class="ruby-identifier">r</span>
|
238
|
-
<span class="ruby-keyword kw">end</span>
|
239
|
-
</pre>
|
240
|
-
</div>
|
241
|
-
</div>
|
242
220
|
</div>
|
243
221
|
<div class="method">
|
244
222
|
<div class="title">
|
245
|
-
<a name="
|
223
|
+
<a name="M000434"></a><b>commonality</b>( &block )
|
246
224
|
</div>
|
247
225
|
<div class="description">
|
248
226
|
<p>
|
@@ -264,8 +242,8 @@ CREDIT: Florian Gross
|
|
264
242
|
</p>
|
265
243
|
</div>
|
266
244
|
<div class="sourcecode">
|
267
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
268
|
-
<div id="
|
245
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000434_source')" id="l_M000434_source">+</a> ]</p>
|
246
|
+
<div id="M000434_source" class="dyn-source">
|
269
247
|
<pre>
|
270
248
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/commonality.rb, line 17</span>
|
271
249
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commonality</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
@@ -288,17 +266,17 @@ CREDIT: Florian Gross
|
|
288
266
|
</div>
|
289
267
|
<div class="method">
|
290
268
|
<div class="title">
|
291
|
-
<a name="
|
269
|
+
<a name="M000457"></a><b>compact_collect</b>(trash=nil, &block)
|
292
270
|
</div>
|
293
271
|
<div class="description">
|
294
272
|
<p>
|
295
|
-
Alias for <a href="Enumerable.html#
|
273
|
+
Alias for <a href="Enumerable.html#M000456">compact_map</a>
|
296
274
|
</p>
|
297
275
|
</div>
|
298
276
|
</div>
|
299
277
|
<div class="method">
|
300
278
|
<div class="title">
|
301
|
-
<a name="
|
279
|
+
<a name="M000456"></a><b>compact_map</b>(trash=nil) {|*a| ...}
|
302
280
|
</div>
|
303
281
|
<div class="description">
|
304
282
|
<p>
|
@@ -325,13 +303,13 @@ CREDIT: Trans
|
|
325
303
|
</div>
|
326
304
|
<div class="aka">
|
327
305
|
This method is also aliased as
|
328
|
-
<a href="Enumerable.html#
|
306
|
+
<a href="Enumerable.html#M000457">compact_collect</a>
|
329
307
|
</div>
|
330
308
|
<div class="sourcecode">
|
331
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
332
|
-
<div id="
|
309
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000456_source')" id="l_M000456_source">+</a> ]</p>
|
310
|
+
<div id="M000456_source" class="dyn-source">
|
333
311
|
<pre>
|
334
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/
|
312
|
+
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/compact_map.rb, line 18</span>
|
335
313
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compact_map</span>(<span class="ruby-identifier">trash</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
336
314
|
<span class="ruby-identifier">y</span> = []
|
337
315
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
@@ -352,7 +330,7 @@ CREDIT: Trans
|
|
352
330
|
</div>
|
353
331
|
<div class="method">
|
354
332
|
<div class="title">
|
355
|
-
<a name="
|
333
|
+
<a name="M000454"></a><b>count</b>(*c)
|
356
334
|
</div>
|
357
335
|
<div class="description">
|
358
336
|
<p>
|
@@ -375,8 +353,8 @@ CREDIT: Trans
|
|
375
353
|
</p>
|
376
354
|
</div>
|
377
355
|
<div class="sourcecode">
|
378
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
379
|
-
<div id="
|
356
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000454_source')" id="l_M000454_source">+</a> ]</p>
|
357
|
+
<div id="M000454_source" class="dyn-source">
|
380
358
|
<pre>
|
381
359
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/count.rb, line 19</span>
|
382
360
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">count</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">c</span>)
|
@@ -388,7 +366,7 @@ CREDIT: Trans
|
|
388
366
|
</div>
|
389
367
|
<div class="method">
|
390
368
|
<div class="title">
|
391
|
-
<a name="
|
369
|
+
<a name="M000437"></a><b>divide</b>(pattern)
|
392
370
|
</div>
|
393
371
|
<div class="description">
|
394
372
|
<p>
|
@@ -403,8 +381,8 @@ CREDIT: Trans
|
|
403
381
|
</p>
|
404
382
|
</div>
|
405
383
|
<div class="sourcecode">
|
406
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
407
|
-
<div id="
|
384
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000437_source')" id="l_M000437_source">+</a> ]</p>
|
385
|
+
<div id="M000437_source" class="dyn-source">
|
408
386
|
<pre>
|
409
387
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/divide.rb, line 10</span>
|
410
388
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">divide</span>(<span class="ruby-identifier">pattern</span>)
|
@@ -421,17 +399,17 @@ CREDIT: Trans
|
|
421
399
|
</div>
|
422
400
|
<div class="method">
|
423
401
|
<div class="title">
|
424
|
-
<a name="
|
402
|
+
<a name="M000440"></a><b>duplicates</b>()
|
425
403
|
</div>
|
426
404
|
<div class="description">
|
427
405
|
<p>
|
428
|
-
Alias for <a href="Enumerable.html#
|
406
|
+
Alias for <a href="Enumerable.html#M000439">nonuniq</a>
|
429
407
|
</p>
|
430
408
|
</div>
|
431
409
|
</div>
|
432
410
|
<div class="method">
|
433
411
|
<div class="title">
|
434
|
-
<a name="
|
412
|
+
<a name="M000455"></a><b>each_by</b>(steps=nil, &block)
|
435
413
|
</div>
|
436
414
|
<div class="description">
|
437
415
|
<p>
|
@@ -456,8 +434,8 @@ CREDIT: Trans
|
|
456
434
|
</p>
|
457
435
|
</div>
|
458
436
|
<div class="sourcecode">
|
459
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
460
|
-
<div id="
|
437
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000455_source')" id="l_M000455_source">+</a> ]</p>
|
438
|
+
<div id="M000455_source" class="dyn-source">
|
461
439
|
<pre>
|
462
440
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/each_by.rb, line 22</span>
|
463
441
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_by</span>(<span class="ruby-identifier">steps</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -475,13 +453,13 @@ CREDIT: Trans
|
|
475
453
|
</div>
|
476
454
|
<div class="method">
|
477
455
|
<div class="title">
|
478
|
-
<a name="
|
456
|
+
<a name="M000447"></a><b>entropy</b>()
|
479
457
|
</div>
|
480
458
|
<div class="description">
|
481
459
|
<p>
|
482
|
-
Shannon‘s <a href="Enumerable.html#
|
460
|
+
Shannon‘s <a href="Enumerable.html#M000447">entropy</a> for an array
|
483
461
|
- returns the average bits per symbol required to encode the array. Lower
|
484
|
-
values mean less "<a href="Enumerable.html#
|
462
|
+
values mean less "<a href="Enumerable.html#M000447">entropy</a>"
|
485
463
|
- i.e. less unique information in the array.
|
486
464
|
</p>
|
487
465
|
<pre>
|
@@ -492,8 +470,8 @@ CREDIT: Derek
|
|
492
470
|
</p>
|
493
471
|
</div>
|
494
472
|
<div class="sourcecode">
|
495
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
496
|
-
<div id="
|
473
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000447_source')" id="l_M000447_source">+</a> ]</p>
|
474
|
+
<div id="M000447_source" class="dyn-source">
|
497
475
|
<pre>
|
498
476
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/entropy.rb, line 14</span>
|
499
477
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entropy</span>
|
@@ -511,20 +489,20 @@ CREDIT: Derek
|
|
511
489
|
</div>
|
512
490
|
<div class="method">
|
513
491
|
<div class="title">
|
514
|
-
<a name="
|
492
|
+
<a name="M000436"></a><b>frequency</b>()
|
515
493
|
</div>
|
516
494
|
<div class="description">
|
517
495
|
<p>
|
518
496
|
Generates a hash mapping each unique symbol in the array to the absolute <a
|
519
|
-
href="Enumerable.html#
|
497
|
+
href="Enumerable.html#M000436">frequency</a> it appears.
|
520
498
|
</p>
|
521
499
|
<p>
|
522
500
|
CREDIT: Brian Schröder
|
523
501
|
</p>
|
524
502
|
</div>
|
525
503
|
<div class="sourcecode">
|
526
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
527
|
-
<div id="
|
504
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000436_source')" id="l_M000436_source">+</a> ]</p>
|
505
|
+
<div id="M000436_source" class="dyn-source">
|
528
506
|
<pre>
|
529
507
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/frequency.rb, line 8</span>
|
530
508
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">frequency</span>
|
@@ -541,21 +519,21 @@ CREDIT: Brian Schröder
|
|
541
519
|
</div>
|
542
520
|
<div class="method">
|
543
521
|
<div class="title">
|
544
|
-
<a name="
|
522
|
+
<a name="M000445"></a><b>graph</b>(&yld)
|
545
523
|
</div>
|
546
524
|
<div class="description">
|
547
525
|
<p>
|
548
|
-
Alias for <a href="Enumerable.html#
|
526
|
+
Alias for <a href="Enumerable.html#M000444">mash</a>
|
549
527
|
</p>
|
550
528
|
</div>
|
551
529
|
</div>
|
552
530
|
<div class="method">
|
553
531
|
<div class="title">
|
554
|
-
<a name="
|
532
|
+
<a name="M000431"></a><b>group_by</b>( {|| ...}
|
555
533
|
</div>
|
556
534
|
<div class="description">
|
557
535
|
<p>
|
558
|
-
<a href="Enumerable.html#
|
536
|
+
<a href="Enumerable.html#M000431">group_by</a> is used to group items in a
|
559
537
|
collection by something they have in common. The common factor is the key
|
560
538
|
in the resulting hash, the array of like elements is the value.
|
561
539
|
</p>
|
@@ -571,8 +549,8 @@ CREDIT: Erik Veenstra
|
|
571
549
|
</p>
|
572
550
|
</div>
|
573
551
|
<div class="sourcecode">
|
574
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
575
|
-
<div id="
|
552
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000431_source')" id="l_M000431_source">+</a> ]</p>
|
553
|
+
<div id="M000431_source" class="dyn-source">
|
576
554
|
<pre>
|
577
555
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/group_by.rb, line 17</span>
|
578
556
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">group_by</span> <span class="ruby-comment cmt">#:yield:</span>
|
@@ -587,12 +565,12 @@ CREDIT: Erik Veenstra
|
|
587
565
|
</div>
|
588
566
|
<div class="method">
|
589
567
|
<div class="title">
|
590
|
-
<a name="
|
568
|
+
<a name="M000448"></a><b>ideal_entropy</b>()
|
591
569
|
</div>
|
592
570
|
<div class="description">
|
593
571
|
<p>
|
594
572
|
Returns the maximum possible Shannon <a
|
595
|
-
href="Enumerable.html#
|
573
|
+
href="Enumerable.html#M000447">entropy</a> of the array with given size
|
596
574
|
assuming that it is an "order-0" source (each element is selected
|
597
575
|
independently of the next).
|
598
576
|
</p>
|
@@ -601,8 +579,8 @@ CREDIT: Derek
|
|
601
579
|
</p>
|
602
580
|
</div>
|
603
581
|
<div class="sourcecode">
|
604
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
605
|
-
<div id="
|
582
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000448_source')" id="l_M000448_source">+</a> ]</p>
|
583
|
+
<div id="M000448_source" class="dyn-source">
|
606
584
|
<pre>
|
607
585
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/entropy.rb, line 30</span>
|
608
586
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ideal_entropy</span>
|
@@ -616,7 +594,7 @@ CREDIT: Derek
|
|
616
594
|
</div>
|
617
595
|
<div class="method">
|
618
596
|
<div class="title">
|
619
|
-
<a name="
|
597
|
+
<a name="M000438"></a><b>inject!</b>(s) {|k, i| ...}
|
620
598
|
</div>
|
621
599
|
<div class="description">
|
622
600
|
<p>
|
@@ -624,7 +602,7 @@ A small variation of Inject that save one from having to return the
|
|
624
602
|
aggregating or memo argument.
|
625
603
|
</p>
|
626
604
|
<p>
|
627
|
-
Say you want to <a href="Enumerable.html#
|
605
|
+
Say you want to <a href="Enumerable.html#M000454">count</a> letters.
|
628
606
|
</p>
|
629
607
|
<pre>
|
630
608
|
some_text.inject!(Hash.new(0)) {|h,l| h[l] += 1}
|
@@ -640,8 +618,8 @@ CREDIT: David Black, Louis J Scoras
|
|
640
618
|
</p>
|
641
619
|
</div>
|
642
620
|
<div class="sourcecode">
|
643
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
644
|
-
<div id="
|
621
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000438_source')" id="l_M000438_source">+</a> ]</p>
|
622
|
+
<div id="M000438_source" class="dyn-source">
|
645
623
|
<pre>
|
646
624
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/inject.rb, line 16</span>
|
647
625
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inject!</span>(<span class="ruby-identifier">s</span>)
|
@@ -655,7 +633,7 @@ CREDIT: David Black, Louis J Scoras
|
|
655
633
|
</div>
|
656
634
|
<div class="method">
|
657
635
|
<div class="title">
|
658
|
-
<a name="
|
636
|
+
<a name="M000450"></a><b>map_send</b>(meth, *args, &block)
|
659
637
|
</div>
|
660
638
|
<div class="description">
|
661
639
|
<p>
|
@@ -666,8 +644,8 @@ CREDIT: Sean O‘Halpin
|
|
666
644
|
</p>
|
667
645
|
</div>
|
668
646
|
<div class="sourcecode">
|
669
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
670
|
-
<div id="
|
647
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000450_source')" id="l_M000450_source">+</a> ]</p>
|
648
|
+
<div id="M000450_source" class="dyn-source">
|
671
649
|
<pre>
|
672
650
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/map_send.rb, line 7</span>
|
673
651
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map_send</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -679,17 +657,43 @@ CREDIT: Sean O‘Halpin
|
|
679
657
|
</div>
|
680
658
|
<div class="method">
|
681
659
|
<div class="title">
|
682
|
-
<a name="
|
660
|
+
<a name="M000452"></a><b>map_with_index</b>() {|self[i], i| ...}
|
683
661
|
</div>
|
684
662
|
<div class="description">
|
685
663
|
<p>
|
686
|
-
|
664
|
+
Same as collect but with an iteration counter.
|
687
665
|
</p>
|
666
|
+
<pre>
|
667
|
+
a = [1,2,3].collect_with_index { |e,i| e*i }
|
668
|
+
a #=> [0,2,6]
|
669
|
+
</pre>
|
670
|
+
<p>
|
671
|
+
CREDIT: Gavin Sinclair
|
672
|
+
</p>
|
673
|
+
</div>
|
674
|
+
<div class="aka">
|
675
|
+
This method is also aliased as
|
676
|
+
<a href="Enumerable.html#M000453">collect_with_index</a>
|
677
|
+
</div>
|
678
|
+
<div class="sourcecode">
|
679
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000452_source')" id="l_M000452_source">+</a> ]</p>
|
680
|
+
<div id="M000452_source" class="dyn-source">
|
681
|
+
<pre>
|
682
|
+
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/map_with_index.rb, line 10</span>
|
683
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map_with_index</span>
|
684
|
+
<span class="ruby-identifier">r</span> = []
|
685
|
+
<span class="ruby-identifier">each_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
686
|
+
<span class="ruby-identifier">r</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>], <span class="ruby-identifier">i</span>)
|
687
|
+
<span class="ruby-keyword kw">end</span>
|
688
|
+
<span class="ruby-identifier">r</span>
|
689
|
+
<span class="ruby-keyword kw">end</span>
|
690
|
+
</pre>
|
688
691
|
</div>
|
689
692
|
</div>
|
693
|
+
</div>
|
690
694
|
<div class="method">
|
691
695
|
<div class="title">
|
692
|
-
<a name="
|
696
|
+
<a name="M000444"></a><b>mash</b>(&yld)
|
693
697
|
</div>
|
694
698
|
<div class="description">
|
695
699
|
<p>
|
@@ -703,7 +707,7 @@ key and the value for the new hash.
|
|
703
707
|
sq_roots = numbers.mash { |n| [n*n, n] } # { 1=>1, 4=>2, 9=>3 }
|
704
708
|
</pre>
|
705
709
|
<p>
|
706
|
-
The name "<a href="Enumerable.html#
|
710
|
+
The name "<a href="Enumerable.html#M000444">mash</a>" stands for
|
707
711
|
"map hash".
|
708
712
|
</p>
|
709
713
|
<p>
|
@@ -712,11 +716,11 @@ CREDIT: Andrew Dudzik (adudzik), Trans
|
|
712
716
|
</div>
|
713
717
|
<div class="aka">
|
714
718
|
This method is also aliased as
|
715
|
-
<a href="Enumerable.html#
|
719
|
+
<a href="Enumerable.html#M000445">graph</a>
|
716
720
|
</div>
|
717
721
|
<div class="sourcecode">
|
718
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
719
|
-
<div id="
|
722
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000444_source')" id="l_M000444_source">+</a> ]</p>
|
723
|
+
<div id="M000444_source" class="dyn-source">
|
720
724
|
<pre>
|
721
725
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/mash.rb, line 14</span>
|
722
726
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mash</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">yld</span>)
|
@@ -737,11 +741,11 @@ CREDIT: Andrew Dudzik (adudzik), Trans
|
|
737
741
|
</div>
|
738
742
|
<div class="method">
|
739
743
|
<div class="title">
|
740
|
-
<a name="
|
744
|
+
<a name="M000433"></a><b>mode</b>()
|
741
745
|
</div>
|
742
746
|
<div class="description">
|
743
747
|
<p>
|
744
|
-
In Statistics <a href="Enumerable.html#
|
748
|
+
In Statistics <a href="Enumerable.html#M000433">mode</a> is the value that
|
745
749
|
occurs most frequently in a given set of data.
|
746
750
|
</p>
|
747
751
|
<p>
|
@@ -749,8 +753,8 @@ CREDIT: Robert Klemme
|
|
749
753
|
</p>
|
750
754
|
</div>
|
751
755
|
<div class="sourcecode">
|
752
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
753
|
-
<div id="
|
756
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000433_source')" id="l_M000433_source">+</a> ]</p>
|
757
|
+
<div id="M000433_source" class="dyn-source">
|
754
758
|
<pre>
|
755
759
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/mode.rb, line 8</span>
|
756
760
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mode</span>
|
@@ -765,14 +769,14 @@ CREDIT: Robert Klemme
|
|
765
769
|
</div>
|
766
770
|
<div class="method">
|
767
771
|
<div class="title">
|
768
|
-
<a name="
|
772
|
+
<a name="M000446"></a><b>modulate</b>(modulo)
|
769
773
|
</div>
|
770
774
|
<div class="description">
|
771
775
|
<p>
|
772
776
|
Modulate. Divide an array into groups by modulo of the index.
|
773
777
|
</p>
|
774
778
|
<p>
|
775
|
-
[2,4,6,8].<a href="Enumerable.html#
|
779
|
+
[2,4,6,8].<a href="Enumerable.html#M000446">modulate</a>(2) #=>
|
776
780
|
[[2,6],[4,8]]
|
777
781
|
</p>
|
778
782
|
<p>
|
@@ -783,8 +787,8 @@ NOTE: Would the better name for this be ‘collate’?
|
|
783
787
|
</p>
|
784
788
|
</div>
|
785
789
|
<div class="sourcecode">
|
786
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
787
|
-
<div id="
|
790
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000446_source')" id="l_M000446_source">+</a> ]</p>
|
791
|
+
<div id="M000446_source" class="dyn-source">
|
788
792
|
<pre>
|
789
793
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/modulate.rb, line 11</span>
|
790
794
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">modulate</span>(<span class="ruby-identifier">modulo</span>)
|
@@ -802,7 +806,7 @@ NOTE: Would the better name for this be ‘collate’?
|
|
802
806
|
</div>
|
803
807
|
<div class="method">
|
804
808
|
<div class="title">
|
805
|
-
<a name="
|
809
|
+
<a name="M000441"></a><b>none?</b>( {|e| ...}
|
806
810
|
</div>
|
807
811
|
<div class="description">
|
808
812
|
<p>
|
@@ -827,8 +831,8 @@ CREDIT: Gavin Sinclair
|
|
827
831
|
</p>
|
828
832
|
</div>
|
829
833
|
<div class="sourcecode">
|
830
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
831
|
-
<div id="
|
834
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000441_source')" id="l_M000441_source">+</a> ]</p>
|
835
|
+
<div id="M000441_source" class="dyn-source">
|
832
836
|
<pre>
|
833
837
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/none.rb, line 21</span>
|
834
838
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">none?</span> <span class="ruby-comment cmt"># :yield: e</span>
|
@@ -844,7 +848,7 @@ CREDIT: Gavin Sinclair
|
|
844
848
|
</div>
|
845
849
|
<div class="method">
|
846
850
|
<div class="title">
|
847
|
-
<a name="
|
851
|
+
<a name="M000439"></a><b>nonuniq</b>()
|
848
852
|
</div>
|
849
853
|
<div class="description">
|
850
854
|
<p>
|
@@ -859,11 +863,11 @@ CREDIT: Martin DeMello
|
|
859
863
|
</div>
|
860
864
|
<div class="aka">
|
861
865
|
This method is also aliased as
|
862
|
-
<a href="Enumerable.html#
|
866
|
+
<a href="Enumerable.html#M000440">duplicates</a>
|
863
867
|
</div>
|
864
868
|
<div class="sourcecode">
|
865
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
866
|
-
<div id="
|
869
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000439_source')" id="l_M000439_source">+</a> ]</p>
|
870
|
+
<div id="M000439_source" class="dyn-source">
|
867
871
|
<pre>
|
868
872
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/duplicates.rb, line 9</span>
|
869
873
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nonuniq</span>
|
@@ -881,12 +885,12 @@ CREDIT: Martin DeMello
|
|
881
885
|
</div>
|
882
886
|
<div class="method">
|
883
887
|
<div class="title">
|
884
|
-
<a name="
|
888
|
+
<a name="M000435"></a><b>occur</b>(n=nil) {|| ...}
|
885
889
|
</div>
|
886
890
|
<div class="description">
|
887
891
|
<p>
|
888
892
|
Returns an array of elements for the elements that <a
|
889
|
-
href="Enumerable.html#
|
893
|
+
href="Enumerable.html#M000435">occur</a> n times. Or according to the
|
890
894
|
results of a given block.
|
891
895
|
</p>
|
892
896
|
<pre>
|
@@ -902,8 +906,8 @@ results of a given block.
|
|
902
906
|
</pre>
|
903
907
|
</div>
|
904
908
|
<div class="sourcecode">
|
905
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
906
|
-
<div id="
|
909
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000435_source')" id="l_M000435_source">+</a> ]</p>
|
910
|
+
<div id="M000435_source" class="dyn-source">
|
907
911
|
<pre>
|
908
912
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/occur.rb, line 16</span>
|
909
913
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">occur</span>(<span class="ruby-identifier">n</span>=<span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt">#:yield:</span>
|
@@ -930,7 +934,7 @@ results of a given block.
|
|
930
934
|
</div>
|
931
935
|
<div class="method">
|
932
936
|
<div class="title">
|
933
|
-
<a name="
|
937
|
+
<a name="M000429"></a><b>one?</b>( {|e| ...}
|
934
938
|
</div>
|
935
939
|
<div class="description">
|
936
940
|
<p>
|
@@ -955,8 +959,8 @@ CREDIT: Gavin Sinclair
|
|
955
959
|
</p>
|
956
960
|
</div>
|
957
961
|
<div class="sourcecode">
|
958
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
959
|
-
<div id="
|
962
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000429_source')" id="l_M000429_source">+</a> ]</p>
|
963
|
+
<div id="M000429_source" class="dyn-source">
|
960
964
|
<pre>
|
961
965
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/one.rb, line 21</span>
|
962
966
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">one?</span> <span class="ruby-comment cmt"># :yield: e</span>
|
@@ -979,12 +983,12 @@ CREDIT: Gavin Sinclair
|
|
979
983
|
</div>
|
980
984
|
<div class="method">
|
981
985
|
<div class="title">
|
982
|
-
<a name="
|
986
|
+
<a name="M000451"></a><b>probability</b>()
|
983
987
|
</div>
|
984
988
|
<div class="description">
|
985
989
|
<p>
|
986
990
|
Generates a hash mapping each unique element in the array to the relative
|
987
|
-
<a href="Enumerable.html#
|
991
|
+
<a href="Enumerable.html#M000436">frequency</a>, i.e. the probablity, of it
|
988
992
|
appearence.
|
989
993
|
</p>
|
990
994
|
<p>
|
@@ -992,8 +996,8 @@ CREDIT: Brian Schröder
|
|
992
996
|
</p>
|
993
997
|
</div>
|
994
998
|
<div class="sourcecode">
|
995
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
996
|
-
<div id="
|
999
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000451_source')" id="l_M000451_source">+</a> ]</p>
|
1000
|
+
<div id="M000451_source" class="dyn-source">
|
997
1001
|
<pre>
|
998
1002
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/probability.rb, line 9</span>
|
999
1003
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">probability</span>
|
@@ -1012,12 +1016,12 @@ CREDIT: Brian Schröder
|
|
1012
1016
|
</div>
|
1013
1017
|
<div class="method">
|
1014
1018
|
<div class="title">
|
1015
|
-
<a name="
|
1019
|
+
<a name="M000449"></a><b>split</b>(pattern)
|
1016
1020
|
</div>
|
1017
1021
|
<div class="description">
|
1018
1022
|
<p>
|
1019
1023
|
Split on matching pattern. Unlike <a
|
1020
|
-
href="Enumerable.html#
|
1024
|
+
href="Enumerable.html#M000437">divide</a> this does not include matching
|
1021
1025
|
elements.
|
1022
1026
|
</p>
|
1023
1027
|
<pre>
|
@@ -1029,13 +1033,13 @@ CREDIT: Trans
|
|
1029
1033
|
</p>
|
1030
1034
|
</div>
|
1031
1035
|
<div class="sourcecode">
|
1032
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
1033
|
-
<div id="
|
1036
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000449_source')" id="l_M000449_source">+</a> ]</p>
|
1037
|
+
<div id="M000449_source" class="dyn-source">
|
1034
1038
|
<pre>
|
1035
1039
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/split.rb, line 10</span>
|
1036
1040
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">split</span>(<span class="ruby-identifier">pattern</span>)
|
1037
|
-
<span class="ruby-identifier">sect</span> = []
|
1038
1041
|
<span class="ruby-identifier">memo</span> = []
|
1042
|
+
<span class="ruby-identifier">sect</span> = []
|
1039
1043
|
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
1040
1044
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">obj</span>
|
1041
1045
|
<span class="ruby-identifier">memo</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sect</span>
|
@@ -1044,8 +1048,8 @@ CREDIT: Trans
|
|
1044
1048
|
<span class="ruby-identifier">sect</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">obj</span>
|
1045
1049
|
<span class="ruby-keyword kw">end</span>
|
1046
1050
|
<span class="ruby-keyword kw">end</span>
|
1047
|
-
<span class="ruby-identifier">memo</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sect</span>
|
1048
|
-
<span class="ruby-identifier">memo</span>.<span class="ruby-identifier">pop</span> <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">memo</span>.<span class="ruby-identifier">last</span
|
1051
|
+
<span class="ruby-identifier">memo</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sect</span>
|
1052
|
+
<span class="ruby-identifier">memo</span>.<span class="ruby-identifier">pop</span> <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">memo</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">==</span> []
|
1049
1053
|
<span class="ruby-identifier">memo</span>
|
1050
1054
|
<span class="ruby-keyword kw">end</span>
|
1051
1055
|
</pre>
|
@@ -1054,11 +1058,11 @@ CREDIT: Trans
|
|
1054
1058
|
</div>
|
1055
1059
|
<div class="method">
|
1056
1060
|
<div class="title">
|
1057
|
-
<a name="
|
1061
|
+
<a name="M000432"></a><b>sum</b>(identity = 0, &block)
|
1058
1062
|
</div>
|
1059
1063
|
<div class="description">
|
1060
1064
|
<p>
|
1061
|
-
Uses #+ to <a href="Enumerable.html#
|
1065
|
+
Uses #+ to <a href="Enumerable.html#M000432">sum</a> the enumerated
|
1062
1066
|
elements.
|
1063
1067
|
</p>
|
1064
1068
|
<pre>
|
@@ -1067,8 +1071,8 @@ elements.
|
|
1067
1071
|
</pre>
|
1068
1072
|
</div>
|
1069
1073
|
<div class="sourcecode">
|
1070
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
1071
|
-
<div id="
|
1074
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000432_source')" id="l_M000432_source">+</a> ]</p>
|
1075
|
+
<div id="M000432_source" class="dyn-source">
|
1072
1076
|
<pre>
|
1073
1077
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/sum.rb, line 8</span>
|
1074
1078
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">identity</span> = <span class="ruby-value">0</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -1084,7 +1088,7 @@ elements.
|
|
1084
1088
|
</div>
|
1085
1089
|
<div class="method">
|
1086
1090
|
<div class="title">
|
1087
|
-
<a name="
|
1091
|
+
<a name="M000428"></a><b>take</b>(n)
|
1088
1092
|
</div>
|
1089
1093
|
<div class="description">
|
1090
1094
|
<p>
|
@@ -1092,8 +1096,8 @@ Return the first n items from the collection
|
|
1092
1096
|
</p>
|
1093
1097
|
</div>
|
1094
1098
|
<div class="sourcecode">
|
1095
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
1096
|
-
<div id="
|
1099
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000428_source')" id="l_M000428_source">+</a> ]</p>
|
1100
|
+
<div id="M000428_source" class="dyn-source">
|
1097
1101
|
<pre>
|
1098
1102
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/take.rb, line 7</span>
|
1099
1103
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">take</span>(<span class="ruby-identifier">n</span>)
|
@@ -1112,7 +1116,7 @@ Return the first n items from the collection
|
|
1112
1116
|
</div>
|
1113
1117
|
<div class="method">
|
1114
1118
|
<div class="title">
|
1115
|
-
<a name="
|
1119
|
+
<a name="M000427"></a><b>to_h</b>(mode=nil)
|
1116
1120
|
</div>
|
1117
1121
|
<div class="description">
|
1118
1122
|
<p>
|
@@ -1124,12 +1128,12 @@ CREDIT: Trans
|
|
1124
1128
|
</p>
|
1125
1129
|
</div>
|
1126
1130
|
<div class="sourcecode">
|
1127
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
1128
|
-
<div id="
|
1131
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000427_source')" id="l_M000427_source">+</a> ]</p>
|
1132
|
+
<div id="M000427_source" class="dyn-source">
|
1129
1133
|
<pre>
|
1130
|
-
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line
|
1131
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h</span>(<span class="ruby-identifier">
|
1132
|
-
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h</span>(<span class="ruby-identifier">
|
1134
|
+
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 265</span>
|
1135
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h</span>(<span class="ruby-identifier">mode</span>=<span class="ruby-keyword kw">nil</span>)
|
1136
|
+
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h</span>(<span class="ruby-identifier">mode</span>)
|
1133
1137
|
<span class="ruby-keyword kw">end</span>
|
1134
1138
|
</pre>
|
1135
1139
|
</div>
|
@@ -1137,7 +1141,7 @@ CREDIT: Trans
|
|
1137
1141
|
</div>
|
1138
1142
|
<div class="method">
|
1139
1143
|
<div class="title">
|
1140
|
-
<a name="
|
1144
|
+
<a name="M000442"></a><b>uniq_by</b>( {|| ...}
|
1141
1145
|
</div>
|
1142
1146
|
<div class="description">
|
1143
1147
|
<p>
|
@@ -1154,8 +1158,8 @@ produces
|
|
1154
1158
|
</pre>
|
1155
1159
|
</div>
|
1156
1160
|
<div class="sourcecode">
|
1157
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
1158
|
-
<div id="
|
1161
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000442_source')" id="l_M000442_source">+</a> ]</p>
|
1162
|
+
<div id="M000442_source" class="dyn-source">
|
1159
1163
|
<pre>
|
1160
1164
|
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/uniq_by.rb, line 11</span>
|
1161
1165
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uniq_by</span> <span class="ruby-comment cmt">#:yield:</span>
|