facets 2.5.1 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +113 -13
- data/MANIFEST +23 -19
- data/RELEASE +22 -22
- data/VERSION +1 -1
- data/doc/{archive → changelogs}/CHANGELOG-0.10.30 +0 -0
- data/doc/{archive → changelogs}/CHANGELOG-1.8.54 +0 -0
- data/doc/{archive → changelogs}/CHANGELOG-2.4.5 +0 -0
- data/doc/log/basic_stats/index.html +4 -4
- data/doc/rdoc/core/classes/Array.html +148 -148
- 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 +224 -139
- data/doc/rdoc/core/classes/Enumerable/Enumerator.html +126 -13
- data/doc/rdoc/core/classes/Enumerator.html +123 -13
- 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 +289 -266
- 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 +161 -161
- 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 +270 -270
- 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 +12 -12
- data/doc/rdoc/core/created.rid +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/dearray_values_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +2 -1
- data/doc/rdoc/core/fr_file_index.html +1 -0
- data/doc/rdoc/core/fr_method_index.html +401 -385
- data/doc/{archive → release-notes}/RELEASE-2.0.5 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.1.0 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.1.1 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.1.2 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.1.3 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.2.0 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.2.1 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.3.0 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.4.0 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.4.1 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.4.2 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.4.3 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.4.4 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.4.5 +0 -0
- data/doc/{archive → release-notes}/RELEASE-2.5.0 +0 -0
- data/lib/core/facets/hash/dearray_values.rb +46 -0
- data/lib/core/facets/to_hash.rb +109 -74
- data/task/setup.rake +17 -9
- data/test/core/hash/test_dearray_values.rb +19 -0
- data/test/core/test_to_hash.rb +116 -24
- metadata +26 -21
@@ -72,13 +72,13 @@
|
|
72
72
|
<div class="description"><h1><a href="Indexable.html">Indexable</a></h1>
|
73
73
|
<p>
|
74
74
|
<a href="Indexable.html">Indexable</a> is a mixin that provides <a
|
75
|
-
href="Indexable.html#
|
76
|
-
four methods: <a href="Indexable.html#
|
75
|
+
href="Indexable.html#M000350">index</a> based methods, working soley with
|
76
|
+
four methods: <a href="Indexable.html#M000350">index</a>, slice, splice and
|
77
77
|
size.
|
78
78
|
</p>
|
79
79
|
<p>
|
80
80
|
These methods work in harmony. Where <a
|
81
|
-
href="Indexable.html#
|
81
|
+
href="Indexable.html#M000350">index</a> returns a position of a given
|
82
82
|
element, slice returns elements for given positions. splice is like slice
|
83
83
|
but replaces the given position with new values. This mehtod is not part of
|
84
84
|
ruby core, but it generally just an alias for #[]=, just as slice is an
|
@@ -90,24 +90,24 @@ indexable object.
|
|
90
90
|
|
91
91
|
|
92
92
|
<div class="sectiontitle">Methods</div>
|
93
|
-
<span style="padding-right: 5px;"><a href="#
|
94
|
-
<span style="padding-right: 5px;"><a href="#
|
95
|
-
<span style="padding-right: 5px;"><a href="#
|
96
|
-
<span style="padding-right: 5px;"><a href="#
|
97
|
-
<span style="padding-right: 5px;"><a href="#
|
98
|
-
<span style="padding-right: 5px;"><a href="#
|
99
|
-
<span style="padding-right: 5px;"><a href="#
|
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="#
|
93
|
+
<span style="padding-right: 5px;"><a href="#M000338">body</a></span>
|
94
|
+
<span style="padding-right: 5px;"><a href="#M000348">ends</a></span>
|
95
|
+
<span style="padding-right: 5px;"><a href="#M000342">first</a></span>
|
96
|
+
<span style="padding-right: 5px;"><a href="#M000346">first!</a></span>
|
97
|
+
<span style="padding-right: 5px;"><a href="#M000344">first=</a></span>
|
98
|
+
<span style="padding-right: 5px;"><a href="#M000337">foot</a></span>
|
99
|
+
<span style="padding-right: 5px;"><a href="#M000335">head</a></span>
|
100
|
+
<span style="padding-right: 5px;"><a href="#M000350">index</a></span>
|
101
|
+
<span style="padding-right: 5px;"><a href="#M000351">index_of</a></span>
|
102
|
+
<span style="padding-right: 5px;"><a href="#M000343">last</a></span>
|
103
|
+
<span style="padding-right: 5px;"><a href="#M000347">last!</a></span>
|
104
|
+
<span style="padding-right: 5px;"><a href="#M000345">last=</a></span>
|
105
|
+
<span style="padding-right: 5px;"><a href="#M000339">mid</a></span>
|
106
|
+
<span style="padding-right: 5px;"><a href="#M000340">middle</a></span>
|
107
|
+
<span style="padding-right: 5px;"><a href="#M000349">pos</a></span>
|
108
|
+
<span style="padding-right: 5px;"><a href="#M000352">range</a></span>
|
109
|
+
<span style="padding-right: 5px;"><a href="#M000336">tail</a></span>
|
110
|
+
<span style="padding-right: 5px;"><a href="#M000341">thru</a></span>
|
111
111
|
|
112
112
|
|
113
113
|
|
@@ -117,12 +117,12 @@ indexable object.
|
|
117
117
|
<div class="sectiontitle">Public Instance methods</div>
|
118
118
|
<div class="method">
|
119
119
|
<div class="title">
|
120
|
-
<a name="
|
120
|
+
<a name="M000338"></a><b>body</b>()
|
121
121
|
</div>
|
122
122
|
<div class="description">
|
123
123
|
<p>
|
124
|
-
Returns an array of the <a href="Indexable.html#
|
125
|
-
upto, but not including, the <a href="Indexable.html#
|
124
|
+
Returns an array of the <a href="Indexable.html#M000342">first</a> element
|
125
|
+
upto, but not including, the <a href="Indexable.html#M000343">last</a>
|
126
126
|
element.
|
127
127
|
</p>
|
128
128
|
<pre>
|
@@ -130,8 +130,8 @@ element.
|
|
130
130
|
</pre>
|
131
131
|
</div>
|
132
132
|
<div class="sourcecode">
|
133
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
134
|
-
<div id="
|
133
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000338_source')" id="l_M000338_source">+</a> ]</p>
|
134
|
+
<div id="M000338_source" class="dyn-source">
|
135
135
|
<pre>
|
136
136
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 71</span>
|
137
137
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">body</span>
|
@@ -143,13 +143,13 @@ element.
|
|
143
143
|
</div>
|
144
144
|
<div class="method">
|
145
145
|
<div class="title">
|
146
|
-
<a name="
|
146
|
+
<a name="M000348"></a><b>ends</b>()
|
147
147
|
</div>
|
148
148
|
<div class="description">
|
149
149
|
<p>
|
150
|
-
A shorting of "<a href="Indexable.html#
|
151
|
-
returns the <a href="Indexable.html#
|
152
|
-
href="Indexable.html#
|
150
|
+
A shorting of "<a href="Indexable.html#M000348">ends</a> at",
|
151
|
+
returns the <a href="Indexable.html#M000343">last</a> <a
|
152
|
+
href="Indexable.html#M000350">index</a> of the indexable object. Returns
|
153
153
|
nil if there are no elements.
|
154
154
|
</p>
|
155
155
|
<pre>
|
@@ -160,8 +160,8 @@ This nearly equivalent to +size - 1+.
|
|
160
160
|
</p>
|
161
161
|
</div>
|
162
162
|
<div class="sourcecode">
|
163
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
164
|
-
<div id="
|
163
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000348_source')" id="l_M000348_source">+</a> ]</p>
|
164
|
+
<div id="M000348_source" class="dyn-source">
|
165
165
|
<pre>
|
166
166
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 192</span>
|
167
167
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ends</span>
|
@@ -174,19 +174,19 @@ This nearly equivalent to +size - 1+.
|
|
174
174
|
</div>
|
175
175
|
<div class="method">
|
176
176
|
<div class="title">
|
177
|
-
<a name="
|
177
|
+
<a name="M000342"></a><b>first</b>(n=1)
|
178
178
|
</div>
|
179
179
|
<div class="description">
|
180
180
|
<p>
|
181
|
-
Returns <a href="Indexable.html#
|
181
|
+
Returns <a href="Indexable.html#M000342">first</a> <em>n</em> elements.
|
182
182
|
</p>
|
183
183
|
<pre>
|
184
184
|
"Hello World".first(3) #=> "Hel"
|
185
185
|
</pre>
|
186
186
|
</div>
|
187
187
|
<div class="sourcecode">
|
188
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
189
|
-
<div id="
|
188
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000342_source')" id="l_M000342_source">+</a> ]</p>
|
189
|
+
<div id="M000342_source" class="dyn-source">
|
190
190
|
<pre>
|
191
191
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 130</span>
|
192
192
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">1</span>)
|
@@ -198,11 +198,11 @@ Returns <a href="Indexable.html#M000336">first</a> <em>n</em> elements.
|
|
198
198
|
</div>
|
199
199
|
<div class="method">
|
200
200
|
<div class="title">
|
201
|
-
<a name="
|
201
|
+
<a name="M000346"></a><b>first!</b>()
|
202
202
|
</div>
|
203
203
|
<div class="description">
|
204
204
|
<p>
|
205
|
-
Remove and return the <a href="Indexable.html#
|
205
|
+
Remove and return the <a href="Indexable.html#M000342">first</a> element.
|
206
206
|
</p>
|
207
207
|
<pre>
|
208
208
|
a = [1,2,3]
|
@@ -211,8 +211,8 @@ Remove and return the <a href="Indexable.html#M000336">first</a> element.
|
|
211
211
|
</pre>
|
212
212
|
</div>
|
213
213
|
<div class="sourcecode">
|
214
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
215
|
-
<div id="
|
214
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000346_source')" id="l_M000346_source">+</a> ]</p>
|
215
|
+
<div id="M000346_source" class="dyn-source">
|
216
216
|
<pre>
|
217
217
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 170</span>
|
218
218
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first!</span>
|
@@ -224,11 +224,11 @@ Remove and return the <a href="Indexable.html#M000336">first</a> element.
|
|
224
224
|
</div>
|
225
225
|
<div class="method">
|
226
226
|
<div class="title">
|
227
|
-
<a name="
|
227
|
+
<a name="M000344"></a><b>first=</b>(x)
|
228
228
|
</div>
|
229
229
|
<div class="description">
|
230
230
|
<p>
|
231
|
-
Change the <a href="Indexable.html#
|
231
|
+
Change the <a href="Indexable.html#M000342">first</a> element.
|
232
232
|
</p>
|
233
233
|
<pre>
|
234
234
|
a = ["a","y","z"]
|
@@ -237,8 +237,8 @@ Change the <a href="Indexable.html#M000336">first</a> element.
|
|
237
237
|
</pre>
|
238
238
|
</div>
|
239
239
|
<div class="sourcecode">
|
240
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
241
|
-
<div id="
|
240
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000344_source')" id="l_M000344_source">+</a> ]</p>
|
241
|
+
<div id="M000344_source" class="dyn-source">
|
242
242
|
<pre>
|
243
243
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 150</span>
|
244
244
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first=</span>(<span class="ruby-identifier">x</span>)
|
@@ -250,20 +250,20 @@ Change the <a href="Indexable.html#M000336">first</a> element.
|
|
250
250
|
</div>
|
251
251
|
<div class="method">
|
252
252
|
<div class="title">
|
253
|
-
<a name="
|
253
|
+
<a name="M000337"></a><b>foot</b>()
|
254
254
|
</div>
|
255
255
|
<div class="description">
|
256
256
|
<p>
|
257
|
-
Like <a href="Indexable.html#
|
258
|
-
href="Indexable.html#
|
257
|
+
Like <a href="Indexable.html#M000343">last</a>, returning the <a
|
258
|
+
href="Indexable.html#M000343">last</a> element in an array.
|
259
259
|
</p>
|
260
260
|
<pre>
|
261
261
|
[1,2,3].foot #=> [3]
|
262
262
|
</pre>
|
263
263
|
</div>
|
264
264
|
<div class="sourcecode">
|
265
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
266
|
-
<div id="
|
265
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000337_source')" id="l_M000337_source">+</a> ]</p>
|
266
|
+
<div id="M000337_source" class="dyn-source">
|
267
267
|
<pre>
|
268
268
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 58</span>
|
269
269
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">foot</span>
|
@@ -275,20 +275,20 @@ href="Indexable.html#M000337">last</a> element in an array.
|
|
275
275
|
</div>
|
276
276
|
<div class="method">
|
277
277
|
<div class="title">
|
278
|
-
<a name="
|
278
|
+
<a name="M000335"></a><b>head</b>()
|
279
279
|
</div>
|
280
280
|
<div class="description">
|
281
281
|
<p>
|
282
|
-
Like <a href="Indexable.html#
|
283
|
-
href="Indexable.html#
|
282
|
+
Like <a href="Indexable.html#M000342">first</a> but returns the <a
|
283
|
+
href="Indexable.html#M000342">first</a> element in a new array.
|
284
284
|
</p>
|
285
285
|
<pre>
|
286
286
|
[1,2,3].head #=> [1]
|
287
287
|
</pre>
|
288
288
|
</div>
|
289
289
|
<div class="sourcecode">
|
290
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
291
|
-
<div id="
|
290
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000335_source')" id="l_M000335_source">+</a> ]</p>
|
291
|
+
<div id="M000335_source" class="dyn-source">
|
292
292
|
<pre>
|
293
293
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 41</span>
|
294
294
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">head</span>
|
@@ -300,12 +300,12 @@ href="Indexable.html#M000336">first</a> element in a new array.
|
|
300
300
|
</div>
|
301
301
|
<div class="method">
|
302
302
|
<div class="title">
|
303
|
-
<a name="
|
303
|
+
<a name="M000350"></a><b>index</b>(obj=nil) {|slice(i)| ...}
|
304
304
|
</div>
|
305
305
|
<div class="description">
|
306
306
|
<p>
|
307
|
-
Returns the <a href="Indexable.html#
|
308
|
-
href="Indexable.html#
|
307
|
+
Returns the <a href="Indexable.html#M000350">index</a> of the <a
|
308
|
+
href="Indexable.html#M000342">first</a> element equal to the given object
|
309
309
|
or satisfying the block condition.
|
310
310
|
</p>
|
311
311
|
<pre>
|
@@ -315,11 +315,11 @@ or satisfying the block condition.
|
|
315
315
|
</div>
|
316
316
|
<div class="aka">
|
317
317
|
This method is also aliased as
|
318
|
-
<a href="Indexable.html#
|
318
|
+
<a href="Indexable.html#M000351">index_of</a>
|
319
319
|
</div>
|
320
320
|
<div class="sourcecode">
|
321
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
322
|
-
<div id="
|
321
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000350_source')" id="l_M000350_source">+</a> ]</p>
|
322
|
+
<div id="M000350_source" class="dyn-source">
|
323
323
|
<pre>
|
324
324
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 217</span>
|
325
325
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">obj</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -340,29 +340,29 @@ or satisfying the block condition.
|
|
340
340
|
</div>
|
341
341
|
<div class="method">
|
342
342
|
<div class="title">
|
343
|
-
<a name="
|
343
|
+
<a name="M000351"></a><b>index_of</b>(obj=nil, &block)
|
344
344
|
</div>
|
345
345
|
<div class="description">
|
346
346
|
<p>
|
347
|
-
Alias for <a href="Indexable.html#
|
347
|
+
Alias for <a href="Indexable.html#M000350">index</a>
|
348
348
|
</p>
|
349
349
|
</div>
|
350
350
|
</div>
|
351
351
|
<div class="method">
|
352
352
|
<div class="title">
|
353
|
-
<a name="
|
353
|
+
<a name="M000343"></a><b>last</b>(n=1)
|
354
354
|
</div>
|
355
355
|
<div class="description">
|
356
356
|
<p>
|
357
|
-
Returns <a href="Indexable.html#
|
357
|
+
Returns <a href="Indexable.html#M000343">last</a> <em>n</em> elements.
|
358
358
|
</p>
|
359
359
|
<pre>
|
360
360
|
"Hello World".last(3) #=> "rld"
|
361
361
|
</pre>
|
362
362
|
</div>
|
363
363
|
<div class="sourcecode">
|
364
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
365
|
-
<div id="
|
364
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000343_source')" id="l_M000343_source">+</a> ]</p>
|
365
|
+
<div id="M000343_source" class="dyn-source">
|
366
366
|
<pre>
|
367
367
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 138</span>
|
368
368
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">1</span>)
|
@@ -376,11 +376,11 @@ Returns <a href="Indexable.html#M000337">last</a> <em>n</em> elements.
|
|
376
376
|
</div>
|
377
377
|
<div class="method">
|
378
378
|
<div class="title">
|
379
|
-
<a name="
|
379
|
+
<a name="M000347"></a><b>last!</b>()
|
380
380
|
</div>
|
381
381
|
<div class="description">
|
382
382
|
<p>
|
383
|
-
Remove and return the <a href="Indexable.html#
|
383
|
+
Remove and return the <a href="Indexable.html#M000343">last</a> element.
|
384
384
|
</p>
|
385
385
|
<pre>
|
386
386
|
a = [1,2,3]
|
@@ -389,8 +389,8 @@ Remove and return the <a href="Indexable.html#M000337">last</a> element.
|
|
389
389
|
</pre>
|
390
390
|
</div>
|
391
391
|
<div class="sourcecode">
|
392
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
393
|
-
<div id="
|
392
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000347_source')" id="l_M000347_source">+</a> ]</p>
|
393
|
+
<div id="M000347_source" class="dyn-source">
|
394
394
|
<pre>
|
395
395
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 180</span>
|
396
396
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last!</span>
|
@@ -402,11 +402,11 @@ Remove and return the <a href="Indexable.html#M000337">last</a> element.
|
|
402
402
|
</div>
|
403
403
|
<div class="method">
|
404
404
|
<div class="title">
|
405
|
-
<a name="
|
405
|
+
<a name="M000345"></a><b>last=</b>(x)
|
406
406
|
</div>
|
407
407
|
<div class="description">
|
408
408
|
<p>
|
409
|
-
Change the <a href="Indexable.html#
|
409
|
+
Change the <a href="Indexable.html#M000343">last</a> element.
|
410
410
|
</p>
|
411
411
|
<pre>
|
412
412
|
a = [1,2,5]
|
@@ -415,8 +415,8 @@ Change the <a href="Indexable.html#M000337">last</a> element.
|
|
415
415
|
</pre>
|
416
416
|
</div>
|
417
417
|
<div class="sourcecode">
|
418
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
419
|
-
<div id="
|
418
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000345_source')" id="l_M000345_source">+</a> ]</p>
|
419
|
+
<div id="M000345_source" class="dyn-source">
|
420
420
|
<pre>
|
421
421
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 160</span>
|
422
422
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last=</span>(<span class="ruby-identifier">x</span>)
|
@@ -428,16 +428,16 @@ Change the <a href="Indexable.html#M000337">last</a> element.
|
|
428
428
|
</div>
|
429
429
|
<div class="method">
|
430
430
|
<div class="title">
|
431
|
-
<a name="
|
431
|
+
<a name="M000339"></a><b>mid</b>(offset=0)
|
432
432
|
</div>
|
433
433
|
<div class="description">
|
434
434
|
<p>
|
435
|
-
Returns the <a href="Indexable.html#
|
435
|
+
Returns the <a href="Indexable.html#M000340">middle</a> element of an
|
436
436
|
array, or the element offset from <a
|
437
|
-
href="Indexable.html#
|
437
|
+
href="Indexable.html#M000340">middle</a> if the parameter is given.
|
438
438
|
Even-sized arrays, not having an exact <a
|
439
|
-
href="Indexable.html#
|
440
|
-
href="Indexable.html#
|
439
|
+
href="Indexable.html#M000340">middle</a>, return the <a
|
440
|
+
href="Indexable.html#M000340">middle</a>-right element.
|
441
441
|
</p>
|
442
442
|
<pre>
|
443
443
|
[1,2,3,4,5].mid #=> 3
|
@@ -452,8 +452,8 @@ of the two center elements is indexed as orgin (0).
|
|
452
452
|
</p>
|
453
453
|
</div>
|
454
454
|
<div class="sourcecode">
|
455
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
456
|
-
<div id="
|
455
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000339_source')" id="l_M000339_source">+</a> ]</p>
|
456
|
+
<div id="M000339_source" class="dyn-source">
|
457
457
|
<pre>
|
458
458
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 89</span>
|
459
459
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mid</span>(<span class="ruby-identifier">offset</span>=<span class="ruby-value">0</span>)
|
@@ -465,27 +465,27 @@ of the two center elements is indexed as orgin (0).
|
|
465
465
|
</div>
|
466
466
|
<div class="method">
|
467
467
|
<div class="title">
|
468
|
-
<a name="
|
468
|
+
<a name="M000340"></a><b>middle</b>()
|
469
469
|
</div>
|
470
470
|
<div class="description">
|
471
471
|
<p>
|
472
|
-
Returns the <a href="Indexable.html#
|
472
|
+
Returns the <a href="Indexable.html#M000340">middle</a> element(s) of an
|
473
473
|
array. Even-sized arrays, not having an exact <a
|
474
|
-
href="Indexable.html#
|
475
|
-
the two <a href="Indexable.html#
|
474
|
+
href="Indexable.html#M000340">middle</a>, returns a two-element array of
|
475
|
+
the two <a href="Indexable.html#M000340">middle</a> elements.
|
476
476
|
</p>
|
477
477
|
<pre>
|
478
478
|
[1,2,3,4,5].middle #=> 3
|
479
479
|
[1,2,3,4,5,6].middle #=> [3,4]
|
480
480
|
</pre>
|
481
481
|
<p>
|
482
|
-
In contrast to <a href="Indexable.html#
|
482
|
+
In contrast to <a href="Indexable.html#M000339">mid</a> which utilizes an
|
483
483
|
offset.
|
484
484
|
</p>
|
485
485
|
</div>
|
486
486
|
<div class="sourcecode">
|
487
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
488
|
-
<div id="
|
487
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000340_source')" id="l_M000340_source">+</a> ]</p>
|
488
|
+
<div id="M000340_source" class="dyn-source">
|
489
489
|
<pre>
|
490
490
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 102</span>
|
491
491
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">middle</span>
|
@@ -502,11 +502,11 @@ offset.
|
|
502
502
|
</div>
|
503
503
|
<div class="method">
|
504
504
|
<div class="title">
|
505
|
-
<a name="
|
505
|
+
<a name="M000349"></a><b>pos</b>(i)
|
506
506
|
</div>
|
507
507
|
<div class="description">
|
508
508
|
<p>
|
509
|
-
Returns the positive ordinal <a href="Indexable.html#
|
509
|
+
Returns the positive ordinal <a href="Indexable.html#M000350">index</a>
|
510
510
|
given a cardinal position, 1 to n or -n to -1.
|
511
511
|
</p>
|
512
512
|
<pre>
|
@@ -515,8 +515,8 @@ given a cardinal position, 1 to n or -n to -1.
|
|
515
515
|
</pre>
|
516
516
|
</div>
|
517
517
|
<div class="sourcecode">
|
518
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
519
|
-
<div id="
|
518
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000349_source')" id="l_M000349_source">+</a> ]</p>
|
519
|
+
<div id="M000349_source" class="dyn-source">
|
520
520
|
<pre>
|
521
521
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 203</span>
|
522
522
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pos</span>(<span class="ruby-identifier">i</span>)
|
@@ -532,15 +532,15 @@ given a cardinal position, 1 to n or -n to -1.
|
|
532
532
|
</div>
|
533
533
|
<div class="method">
|
534
534
|
<div class="title">
|
535
|
-
<a name="
|
535
|
+
<a name="M000352"></a><b>range</b>(a=nil,z=nil)
|
536
536
|
</div>
|
537
537
|
<div class="description">
|
538
538
|
<p>
|
539
|
-
Returns the <a href="Indexable.html#
|
540
|
-
href="Indexable.html#
|
541
|
-
elements are given, returns the <a href="Indexable.html#
|
542
|
-
from <a href="Indexable.html#
|
543
|
-
href="Indexable.html#
|
539
|
+
Returns the <a href="Indexable.html#M000350">index</a> <a
|
540
|
+
href="Indexable.html#M000352">range</a> between two elements. If no
|
541
|
+
elements are given, returns the <a href="Indexable.html#M000352">range</a>
|
542
|
+
from <a href="Indexable.html#M000342">first</a> to <a
|
543
|
+
href="Indexable.html#M000343">last</a>.
|
544
544
|
</p>
|
545
545
|
<pre>
|
546
546
|
['a','b','c','d'].range #=> 0..3
|
@@ -548,8 +548,8 @@ href="Indexable.html#M000337">last</a>.
|
|
548
548
|
</pre>
|
549
549
|
</div>
|
550
550
|
<div class="sourcecode">
|
551
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
552
|
-
<div id="
|
551
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000352_source')" id="l_M000352_source">+</a> ]</p>
|
552
|
+
<div id="M000352_source" class="dyn-source">
|
553
553
|
<pre>
|
554
554
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 242</span>
|
555
555
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range</span>(<span class="ruby-identifier">a</span>=<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">z</span>=<span class="ruby-keyword kw">nil</span>)
|
@@ -565,20 +565,20 @@ href="Indexable.html#M000337">last</a>.
|
|
565
565
|
</div>
|
566
566
|
<div class="method">
|
567
567
|
<div class="title">
|
568
|
-
<a name="
|
568
|
+
<a name="M000336"></a><b>tail</b>()
|
569
569
|
</div>
|
570
570
|
<div class="description">
|
571
571
|
<p>
|
572
572
|
Returns an array from second element to <a
|
573
|
-
href="Indexable.html#
|
573
|
+
href="Indexable.html#M000343">last</a> element.
|
574
574
|
</p>
|
575
575
|
<pre>
|
576
576
|
[1,2,3].tail #=> [2,3]
|
577
577
|
</pre>
|
578
578
|
</div>
|
579
579
|
<div class="sourcecode">
|
580
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
581
|
-
<div id="
|
580
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000336_source')" id="l_M000336_source">+</a> ]</p>
|
581
|
+
<div id="M000336_source" class="dyn-source">
|
582
582
|
<pre>
|
583
583
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 49</span>
|
584
584
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tail</span>
|
@@ -590,13 +590,13 @@ href="Indexable.html#M000337">last</a> element.
|
|
590
590
|
</div>
|
591
591
|
<div class="method">
|
592
592
|
<div class="title">
|
593
|
-
<a name="
|
593
|
+
<a name="M000341"></a><b>thru</b>(from, to)
|
594
594
|
</div>
|
595
595
|
<div class="description">
|
596
596
|
<p>
|
597
|
-
Fetch values from a start <a href="Indexable.html#
|
598
|
-
href="Indexable.html#
|
599
|
-
href="Indexable.html#
|
597
|
+
Fetch values from a start <a href="Indexable.html#M000350">index</a> <a
|
598
|
+
href="Indexable.html#M000341">thru</a> an end <a
|
599
|
+
href="Indexable.html#M000350">index</a>.
|
600
600
|
</p>
|
601
601
|
<pre>
|
602
602
|
[1,2,3,4,5].thru(0,2) #=> [1,2,3]
|
@@ -604,8 +604,8 @@ href="Indexable.html#M000344">index</a>.
|
|
604
604
|
</pre>
|
605
605
|
</div>
|
606
606
|
<div class="sourcecode">
|
607
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
608
|
-
<div id="
|
607
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000341_source')" id="l_M000341_source">+</a> ]</p>
|
608
|
+
<div id="M000341_source" class="dyn-source">
|
609
609
|
<pre>
|
610
610
|
<span class="ruby-comment cmt"># File lib/core/facets/indexable.rb, line 116</span>
|
611
611
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">thru</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>)
|