mack-facets 0.7.1 → 0.7.1.1
Sign up to get free protection for your applications and to get access to all the features.
- metadata +2 -47
- data/doc/classes/Array.html +0 -408
- data/doc/classes/Class.html +0 -233
- data/doc/classes/Hash.html +0 -233
- data/doc/classes/Kernel.html +0 -212
- data/doc/classes/Mack/Facets/DateTime.html +0 -168
- data/doc/classes/Mack/Facets.html +0 -111
- data/doc/classes/Mack/Utils/BlankSlate.html +0 -113
- data/doc/classes/Mack/Utils/Inflector.html +0 -382
- data/doc/classes/Mack/Utils/RegistryList.html +0 -469
- data/doc/classes/Mack/Utils/RegistryMap.html +0 -479
- data/doc/classes/Math.html +0 -188
- data/doc/classes/Module.html +0 -203
- data/doc/classes/NilClass.html +0 -148
- data/doc/classes/Object.html +0 -558
- data/doc/classes/String.html +0 -464
- data/doc/classes/Symbol.html +0 -148
- data/doc/classes/Time.html +0 -204
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -112
- data/doc/files/lib/mack-facets/english_extensions/inflect_rb.html +0 -101
- data/doc/files/lib/mack-facets/english_extensions/numerals_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/array_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/class_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/date_time_rb.html +0 -129
- data/doc/files/lib/mack-facets/extensions/hash_rb.html +0 -108
- data/doc/files/lib/mack-facets/extensions/kernel_rb.html +0 -109
- data/doc/files/lib/mack-facets/extensions/math_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/module_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/nil_class_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/object_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/string_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/symbol_rb.html +0 -101
- data/doc/files/lib/mack-facets/extensions/time_rb.html +0 -108
- data/doc/files/lib/mack-facets/utils/blank_slate_rb.html +0 -101
- data/doc/files/lib/mack-facets/utils/inflections_rb.html +0 -101
- data/doc/files/lib/mack-facets/utils/inflector_rb.html +0 -108
- data/doc/files/lib/mack-facets/utils/options_merger_rb.html +0 -101
- data/doc/files/lib/mack-facets/utils/registry_list_rb.html +0 -108
- data/doc/files/lib/mack-facets/utils/registry_map_rb.html +0 -108
- data/doc/files/lib/mack-facets_rb.html +0 -124
- data/doc/fr_class_index.html +0 -43
- data/doc/fr_file_index.html +0 -48
- data/doc/fr_method_index.html +0 -104
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-facets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.1
|
4
|
+
version: 0.7.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-14 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -73,51 +73,6 @@ files:
|
|
73
73
|
- lib/mack-facets/utils/registry_map.rb
|
74
74
|
- lib/mack-facets.rb
|
75
75
|
- README
|
76
|
-
- doc/classes/Array.html
|
77
|
-
- doc/classes/Class.html
|
78
|
-
- doc/classes/Hash.html
|
79
|
-
- doc/classes/Kernel.html
|
80
|
-
- doc/classes/Mack/Facets/DateTime.html
|
81
|
-
- doc/classes/Mack/Facets.html
|
82
|
-
- doc/classes/Mack/Utils/BlankSlate.html
|
83
|
-
- doc/classes/Mack/Utils/Inflector.html
|
84
|
-
- doc/classes/Mack/Utils/RegistryList.html
|
85
|
-
- doc/classes/Mack/Utils/RegistryMap.html
|
86
|
-
- doc/classes/Math.html
|
87
|
-
- doc/classes/Module.html
|
88
|
-
- doc/classes/NilClass.html
|
89
|
-
- doc/classes/Object.html
|
90
|
-
- doc/classes/String.html
|
91
|
-
- doc/classes/Symbol.html
|
92
|
-
- doc/classes/Time.html
|
93
|
-
- doc/created.rid
|
94
|
-
- doc/files/lib/mack-facets/english_extensions/inflect_rb.html
|
95
|
-
- doc/files/lib/mack-facets/english_extensions/numerals_rb.html
|
96
|
-
- doc/files/lib/mack-facets/extensions/array_rb.html
|
97
|
-
- doc/files/lib/mack-facets/extensions/class_rb.html
|
98
|
-
- doc/files/lib/mack-facets/extensions/date_time_rb.html
|
99
|
-
- doc/files/lib/mack-facets/extensions/hash_rb.html
|
100
|
-
- doc/files/lib/mack-facets/extensions/kernel_rb.html
|
101
|
-
- doc/files/lib/mack-facets/extensions/math_rb.html
|
102
|
-
- doc/files/lib/mack-facets/extensions/module_rb.html
|
103
|
-
- doc/files/lib/mack-facets/extensions/nil_class_rb.html
|
104
|
-
- doc/files/lib/mack-facets/extensions/object_rb.html
|
105
|
-
- doc/files/lib/mack-facets/extensions/string_rb.html
|
106
|
-
- doc/files/lib/mack-facets/extensions/symbol_rb.html
|
107
|
-
- doc/files/lib/mack-facets/extensions/time_rb.html
|
108
|
-
- doc/files/lib/mack-facets/utils/blank_slate_rb.html
|
109
|
-
- doc/files/lib/mack-facets/utils/inflections_rb.html
|
110
|
-
- doc/files/lib/mack-facets/utils/inflector_rb.html
|
111
|
-
- doc/files/lib/mack-facets/utils/options_merger_rb.html
|
112
|
-
- doc/files/lib/mack-facets/utils/registry_list_rb.html
|
113
|
-
- doc/files/lib/mack-facets/utils/registry_map_rb.html
|
114
|
-
- doc/files/lib/mack-facets_rb.html
|
115
|
-
- doc/files/README.html
|
116
|
-
- doc/fr_class_index.html
|
117
|
-
- doc/fr_file_index.html
|
118
|
-
- doc/fr_method_index.html
|
119
|
-
- doc/index.html
|
120
|
-
- doc/rdoc-style.css
|
121
76
|
has_rdoc: true
|
122
77
|
homepage: http://www.mackframework.com
|
123
78
|
post_install_message:
|
data/doc/classes/Array.html
DELETED
@@ -1,408 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Array</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Array</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/mack-facets/extensions/array_rb.html">
|
59
|
-
lib/mack-facets/extensions/array.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
<a href="Object.html">
|
69
|
-
Object
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<div id="method-list">
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
89
|
-
|
90
|
-
<div class="name-list">
|
91
|
-
<a href="#M000021">count</a>
|
92
|
-
<a href="#M000022">invert</a>
|
93
|
-
<a href="#M000014">parse_splat_args</a>
|
94
|
-
<a href="#M000017">pick_random</a>
|
95
|
-
<a href="#M000018">random_each</a>
|
96
|
-
<a href="#M000015">randomize</a>
|
97
|
-
<a href="#M000016">randomize!</a>
|
98
|
-
<a href="#M000019">subset?</a>
|
99
|
-
<a href="#M000020">superset?</a>
|
100
|
-
</div>
|
101
|
-
</div>
|
102
|
-
|
103
|
-
</div>
|
104
|
-
|
105
|
-
|
106
|
-
<!-- if includes -->
|
107
|
-
|
108
|
-
<div id="section">
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
<!-- if method_list -->
|
118
|
-
<div id="methods">
|
119
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
120
|
-
|
121
|
-
<div id="method-M000021" class="method-detail">
|
122
|
-
<a name="M000021"></a>
|
123
|
-
|
124
|
-
<div class="method-heading">
|
125
|
-
<a href="#M000021" class="method-signature">
|
126
|
-
<span class="method-name">count</span><span class="method-args">()</span>
|
127
|
-
</a>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
<div class="method-description">
|
131
|
-
<p>
|
132
|
-
This will give you a <a href="Array.html#M000021">count</a>, as a <a
|
133
|
-
href="Hash.html">Hash</a>, of all the values in the <a
|
134
|
-
href="Array.html">Array</a>. %w{spam spam eggs ham eggs spam}.<a
|
135
|
-
href="Array.html#M000021">count</a> # => {"eggs" => 2,
|
136
|
-
"ham" => 1, "spam" => 3}
|
137
|
-
</p>
|
138
|
-
<p><a class="source-toggle" href="#"
|
139
|
-
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
140
|
-
<div class="method-source-code" id="M000021-source">
|
141
|
-
<pre>
|
142
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 76</span>
|
143
|
-
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">count</span>
|
144
|
-
77: <span class="ruby-identifier">k</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
|
145
|
-
78: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>[<span class="ruby-identifier">x</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>}
|
146
|
-
79: <span class="ruby-identifier">k</span>
|
147
|
-
80: <span class="ruby-keyword kw">end</span>
|
148
|
-
</pre>
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
</div>
|
152
|
-
|
153
|
-
<div id="method-M000022" class="method-detail">
|
154
|
-
<a name="M000022"></a>
|
155
|
-
|
156
|
-
<div class="method-heading">
|
157
|
-
<a href="#M000022" class="method-signature">
|
158
|
-
<span class="method-name">invert</span><span class="method-args">()</span>
|
159
|
-
</a>
|
160
|
-
</div>
|
161
|
-
|
162
|
-
<div class="method-description">
|
163
|
-
<p>
|
164
|
-
This will <a href="Array.html#M000022">invert</a> the index and the values
|
165
|
-
and return a <a href="Hash.html">Hash</a> of the results. %w{red yellow
|
166
|
-
orange}.<a href="Array.html#M000022">invert</a> # => {"red"
|
167
|
-
=> 0, "orange" => 2, "yellow" => 1}
|
168
|
-
</p>
|
169
|
-
<p><a class="source-toggle" href="#"
|
170
|
-
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
171
|
-
<div class="method-source-code" id="M000022-source">
|
172
|
-
<pre>
|
173
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 84</span>
|
174
|
-
84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invert</span>
|
175
|
-
85: <span class="ruby-identifier">h</span> = {}
|
176
|
-
86: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each_with_index</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">x</span>] = <span class="ruby-identifier">i</span>}
|
177
|
-
87: <span class="ruby-identifier">h</span>
|
178
|
-
88: <span class="ruby-keyword kw">end</span>
|
179
|
-
</pre>
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
</div>
|
183
|
-
|
184
|
-
<div id="method-M000014" class="method-detail">
|
185
|
-
<a name="M000014"></a>
|
186
|
-
|
187
|
-
<div class="method-heading">
|
188
|
-
<a href="#M000014" class="method-signature">
|
189
|
-
<span class="method-name">parse_splat_args</span><span class="method-args">()</span>
|
190
|
-
</a>
|
191
|
-
</div>
|
192
|
-
|
193
|
-
<div class="method-description">
|
194
|
-
<p>
|
195
|
-
This method is useful when you have a method that looks like this: def
|
196
|
-
foo(*args)
|
197
|
-
</p>
|
198
|
-
<pre>
|
199
|
-
do something
|
200
|
-
</pre>
|
201
|
-
<p>
|
202
|
-
end The problem is when you use the * like that everything that comes in is
|
203
|
-
an array. Here are a few problems with this: foo([1,2,3]) When you pass an
|
204
|
-
array into this type of method you get the following nested array:
|
205
|
-
[[1,2,3]] The <a href="Array.html#M000014">parse_splat_args</a> method, if
|
206
|
-
called, would do this: args.parse_splat_args # => [1,2,3] Now say you
|
207
|
-
called this method like such: foo(1) args would be [1]
|
208
|
-
args.parse_splat_args # => 1 Finally foo args.parse_splat_args # =>
|
209
|
-
nil
|
210
|
-
</p>
|
211
|
-
<p><a class="source-toggle" href="#"
|
212
|
-
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
213
|
-
<div class="method-source-code" id="M000014-source">
|
214
|
-
<pre>
|
215
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 21</span>
|
216
|
-
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_splat_args</span>
|
217
|
-
22: <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">empty?</span>
|
218
|
-
23: <span class="ruby-identifier">args</span> = <span class="ruby-keyword kw">self</span><span class="ruby-comment cmt">#.flatten</span>
|
219
|
-
24: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span>
|
220
|
-
25: <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>
|
221
|
-
26: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-comment cmt"># if there was only one arg passed, return just that, without the array</span>
|
222
|
-
27: <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span>
|
223
|
-
28: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># if no args were passed return nil</span>
|
224
|
-
29: <span class="ruby-keyword kw">else</span>
|
225
|
-
30: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">args</span> <span class="ruby-comment cmt"># else return the array back, cause chances are that's what they passed you!</span>
|
226
|
-
31: <span class="ruby-keyword kw">end</span>
|
227
|
-
32: <span class="ruby-keyword kw">end</span>
|
228
|
-
33: <span class="ruby-keyword kw">end</span>
|
229
|
-
</pre>
|
230
|
-
</div>
|
231
|
-
</div>
|
232
|
-
</div>
|
233
|
-
|
234
|
-
<div id="method-M000017" class="method-detail">
|
235
|
-
<a name="M000017"></a>
|
236
|
-
|
237
|
-
<div class="method-heading">
|
238
|
-
<a href="#M000017" class="method-signature">
|
239
|
-
<span class="method-name">pick_random</span><span class="method-args">()</span>
|
240
|
-
</a>
|
241
|
-
</div>
|
242
|
-
|
243
|
-
<div class="method-description">
|
244
|
-
<p>
|
245
|
-
This will pick a random value from the array
|
246
|
-
</p>
|
247
|
-
<p><a class="source-toggle" href="#"
|
248
|
-
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
249
|
-
<div class="method-source-code" id="M000017-source">
|
250
|
-
<pre>
|
251
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 54</span>
|
252
|
-
54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pick_random</span>
|
253
|
-
55: <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>)]
|
254
|
-
56: <span class="ruby-keyword kw">end</span>
|
255
|
-
</pre>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
|
260
|
-
<div id="method-M000018" class="method-detail">
|
261
|
-
<a name="M000018"></a>
|
262
|
-
|
263
|
-
<div class="method-heading">
|
264
|
-
<a href="#M000018" class="method-signature">
|
265
|
-
<span class="method-name">random_each</span><span class="method-args">() {|x| ...}</span>
|
266
|
-
</a>
|
267
|
-
</div>
|
268
|
-
|
269
|
-
<div class="method-description">
|
270
|
-
<p>
|
271
|
-
This allows you to easily recurse of the array randomly.
|
272
|
-
</p>
|
273
|
-
<p><a class="source-toggle" href="#"
|
274
|
-
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
275
|
-
<div class="method-source-code" id="M000018-source">
|
276
|
-
<pre>
|
277
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 59</span>
|
278
|
-
59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">random_each</span>
|
279
|
-
60: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">randomize</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">x</span>}
|
280
|
-
61: <span class="ruby-keyword kw">end</span>
|
281
|
-
</pre>
|
282
|
-
</div>
|
283
|
-
</div>
|
284
|
-
</div>
|
285
|
-
|
286
|
-
<div id="method-M000015" class="method-detail">
|
287
|
-
<a name="M000015"></a>
|
288
|
-
|
289
|
-
<div class="method-heading">
|
290
|
-
<a href="#M000015" class="method-signature">
|
291
|
-
<span class="method-name">randomize</span><span class="method-args">() {|x, y| ...}</span>
|
292
|
-
</a>
|
293
|
-
</div>
|
294
|
-
|
295
|
-
<div class="method-description">
|
296
|
-
<p>
|
297
|
-
This will return a new instance of the array sorted randomly.
|
298
|
-
</p>
|
299
|
-
<p><a class="source-toggle" href="#"
|
300
|
-
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
301
|
-
<div class="method-source-code" id="M000015-source">
|
302
|
-
<pre>
|
303
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 36</span>
|
304
|
-
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">randomize</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
305
|
-
37: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
306
|
-
38: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sort</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>}
|
307
|
-
39: <span class="ruby-keyword kw">else</span>
|
308
|
-
40: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sort_by</span> { <span class="ruby-identifier">rand</span> }
|
309
|
-
41: <span class="ruby-keyword kw">end</span>
|
310
|
-
42: <span class="ruby-keyword kw">end</span>
|
311
|
-
</pre>
|
312
|
-
</div>
|
313
|
-
</div>
|
314
|
-
</div>
|
315
|
-
|
316
|
-
<div id="method-M000016" class="method-detail">
|
317
|
-
<a name="M000016"></a>
|
318
|
-
|
319
|
-
<div class="method-heading">
|
320
|
-
<a href="#M000016" class="method-signature">
|
321
|
-
<span class="method-name">randomize!</span><span class="method-args">(&block)</span>
|
322
|
-
</a>
|
323
|
-
</div>
|
324
|
-
|
325
|
-
<div class="method-description">
|
326
|
-
<p>
|
327
|
-
This calls the <a href="Array.html#M000015">randomize</a> method, but will
|
328
|
-
permantly replace the existing array.
|
329
|
-
</p>
|
330
|
-
<p><a class="source-toggle" href="#"
|
331
|
-
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
332
|
-
<div class="method-source-code" id="M000016-source">
|
333
|
-
<pre>
|
334
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 45</span>
|
335
|
-
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">randomize!</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
336
|
-
46: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
337
|
-
47: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">randomize</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>))
|
338
|
-
48: <span class="ruby-keyword kw">else</span>
|
339
|
-
49: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">randomize</span>)
|
340
|
-
50: <span class="ruby-keyword kw">end</span>
|
341
|
-
51: <span class="ruby-keyword kw">end</span>
|
342
|
-
</pre>
|
343
|
-
</div>
|
344
|
-
</div>
|
345
|
-
</div>
|
346
|
-
|
347
|
-
<div id="method-M000019" class="method-detail">
|
348
|
-
<a name="M000019"></a>
|
349
|
-
|
350
|
-
<div class="method-heading">
|
351
|
-
<a href="#M000019" class="method-signature">
|
352
|
-
<span class="method-name">subset?</span><span class="method-args">(other)</span>
|
353
|
-
</a>
|
354
|
-
</div>
|
355
|
-
|
356
|
-
<div class="method-description">
|
357
|
-
<p><a class="source-toggle" href="#"
|
358
|
-
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
359
|
-
<div class="method-source-code" id="M000019-source">
|
360
|
-
<pre>
|
361
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 63</span>
|
362
|
-
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">subset?</span>(<span class="ruby-identifier">other</span>)
|
363
|
-
64: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
364
|
-
65: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">other</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">x</span>)
|
365
|
-
66: <span class="ruby-keyword kw">end</span>
|
366
|
-
67: <span class="ruby-keyword kw">true</span>
|
367
|
-
68: <span class="ruby-keyword kw">end</span>
|
368
|
-
</pre>
|
369
|
-
</div>
|
370
|
-
</div>
|
371
|
-
</div>
|
372
|
-
|
373
|
-
<div id="method-M000020" class="method-detail">
|
374
|
-
<a name="M000020"></a>
|
375
|
-
|
376
|
-
<div class="method-heading">
|
377
|
-
<a href="#M000020" class="method-signature">
|
378
|
-
<span class="method-name">superset?</span><span class="method-args">(other)</span>
|
379
|
-
</a>
|
380
|
-
</div>
|
381
|
-
|
382
|
-
<div class="method-description">
|
383
|
-
<p><a class="source-toggle" href="#"
|
384
|
-
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
385
|
-
<div class="method-source-code" id="M000020-source">
|
386
|
-
<pre>
|
387
|
-
<span class="ruby-comment cmt"># File lib/mack-facets/extensions/array.rb, line 70</span>
|
388
|
-
70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">superset?</span>(<span class="ruby-identifier">other</span>)
|
389
|
-
71: <span class="ruby-identifier">other</span>.<span class="ruby-identifier">subset?</span>(<span class="ruby-keyword kw">self</span>)
|
390
|
-
72: <span class="ruby-keyword kw">end</span>
|
391
|
-
</pre>
|
392
|
-
</div>
|
393
|
-
</div>
|
394
|
-
</div>
|
395
|
-
|
396
|
-
|
397
|
-
</div>
|
398
|
-
|
399
|
-
|
400
|
-
</div>
|
401
|
-
|
402
|
-
|
403
|
-
<div id="validator-badges">
|
404
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
405
|
-
</div>
|
406
|
-
|
407
|
-
</body>
|
408
|
-
</html>
|