-
Notifications
You must be signed in to change notification settings - Fork 1
/
Range.html
402 lines (282 loc) · 13.5 KB
/
Range.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="Content-Type" content="text/html; charset=utf-8" />
<title>Class: Range</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/custom.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
relpath = '';
if (relpath != '') relpath += '/';
</script>
<base id="base_target" target="_top" />
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/autocomplete.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
<script type="text/javascript" charset="utf-8" src="js/live.js"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
if (window.top.frames.main) document.body.className = 'frames';
</script>
<div id="header">
<div id="menu">
<a href="object_index.html" target="_self" title="Index (R)">Index (R)</a>
»
<span class="title">Range</span>
<div class="noframes">
<span class="title"></span>
<a id="frames_link" class="link_disabled">Frames</a> |
<a target="_top" id="noframes_link" class="link_disabled">No Frames</a>
<span class="title"></span>
</div>
</div>
<div id="search2">
<div class="search2_center">
<form class="search2" onsubmit="return false;" action="">
<input name="q" type="search" placeholder="Search" id="search_box2" size="30" value="" />
</form>
</div>
<script type="text/javascript" charset="utf-8">
$('#search_box2').focus(function(){
var search_index = relpath + 'search_index.json';
jQuery.getJSON(search_index, go_data);
function go_data(adata) {
$('#search_box2').autocomplete(adata, {
width: 300,
matchContains: true,
formatItem: function(item) {
return item.text;
}
}).result(function(event, item) {
if (window.location.search) {
window.location.href = relpath + $(item.href_tag).attr("href");
} else {
location.href = relpath + $(item.href_tag).attr("href");
}
});
}
});
</script>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Class: Range
</h1>
<div id="info_box">
<dl class="box">
<dt class="r1 last">Defined in:</dt>
<dd class="r1 last">
lib/plist4r/mixin/ruby_stdlib.rb
</dd>
</dl>
</div>
<div class="clear"></div>
<h3 class="inherited">Instance Methods</h3>
<ul id="methods_ribbon">
<li class="r1"><a href="#%26-instance_method" target="_self" title="Range#& (method)">&</a></li>
<li class="r2"><a href="#include_range%3F-instance_method" target="_self" title="Range#include_range? (method)">include_range?</a></li>
<li class="r1"><a href="#size-instance_method" target="_self" title="Range#size (method)">size</a></li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first" id="&-instance_method">
<p class="signature first"">
- (<tt><a href="" target="_self" title="Range (class)">Range</a></tt><sup>?</sup>) <strong>&</strong>(other_range)
</p><div class="docstring">
<div class="discussion">
<p>
The intersection of 2 ranges. Returns nil if there are no common elements.
</p>
</div>
</div>
<div class="tags">
<div class="examples">
<h3>Examples:</h3>
<h4><div class='inline'></div></h4>
<pre class="example code"><span class='float val'>1</span><span class='dot2 op'>..</span><span class='integer val'>10</span> <span class='bitand op'>&</span> <span class='float val'>5</span><span class='dot2 op'>..</span><span class='integer val'>15</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='float val'>5</span><span class='dot2 op'>..</span><span class='integer val'>10</span>
</pre>
</div>
<h3>Returns:</h3>
<ul class="return">
<li>
<span class='type'>(<tt><a href="" target="_self" title="Range (class)">Range</a></tt>, <tt>nil</tt>)</span>
—
<div class='inline'><p>
The intesection between 2 overlapping ranges, or zero
</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r/mixin/ruby_stdlib.rb', line 133</span>
<span class='def def kw'>def</span> <span class='bitand op'>&</span> <span class='other_range identifier id'>other_range</span>
<span class='case case kw'>case</span> <span class='other_range identifier id'>other_range</span>
<span class='when when kw'>when</span> <span class='Range constant id'>Range</span>
<span class='intersection identifier id'>intersection</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
<span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='i identifier id'>i</span><span class='bitor op'>|</span>
<span class='intersection identifier id'>intersection</span> <span class='lshft op'><<</span> <span class='i identifier id'>i</span> <span class='if if_mod kw'>if</span> <span class='other_range identifier id'>other_range</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='i identifier id'>i</span>
<span class='end end kw'>end</span>
<span class='result identifier id'>result</span> <span class='assign token'>=</span> <span class='intersection identifier id'>intersection</span><span class='dot token'>.</span><span class='to_ranges identifier id'>to_ranges</span>
<span class='case case kw'>case</span> <span class='result identifier id'>result</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span>
<span class='when when kw'>when</span> <span class='Integer constant id'>Integer</span>
<span class='return return kw'>return</span> <span class='lparen token'>(</span><span class='result identifier id'>result</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot2 op'>..</span><span class='lparen token'>(</span><span class='result identifier id'>result</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
<span class='when when kw'>when</span> <span class='Range constant id'>Range</span><span class='comma token'>,</span> <span class='nil nil kw'>nil</span>
<span class='return return kw'>return</span> <span class='result identifier id'>result</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
<span class='else else kw'>else</span>
<span class='raise identifier id'>raise</span> <span class='string val'>"unsupported type"</span>
<span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details " id="include_range?-instance_method">
<p class="signature "">
- (<tt>true</tt>, <tt>false</tt>) <strong>include_range?</strong>(other_range)
</p><div class="docstring">
<div class="discussion">
<p>
Does this range wholely include other_range? (true or false)
</p>
</div>
</div>
<div class="tags">
<div class="examples">
<h3>Examples:</h3>
<h4><div class='inline'></div></h4>
<pre class="example code"><span class='lparen token'>(</span><span class='float val'>3</span><span class='dot2 op'>..</span><span class='integer val'>5</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='include_range? fid id'>include_range?</span> <span class='lparen token'>(</span><span class='float val'>3</span><span class='dot2 op'>..</span><span class='integer val'>3</span><span class='rparen token'>)</span>
<span class='assign token'>=</span><span class='gt op'>></span> <span class='true true kw'>true</span>
<span class='lparen token'>(</span><span class='integer val'>0</span><span class='dot2 op'>..</span><span class='integer val'>4</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='include_range? fid id'>include_range?</span> <span class='lparen token'>(</span><span class='float val'>6</span><span class='dot2 op'>..</span><span class='integer val'>7</span><span class='rparen token'>)</span>
<span class='assign token'>=</span><span class='gt op'>></span> <span class='false false kw'>false</span>
</pre>
</div>
<h3>Returns:</h3>
<ul class="return">
<li>
<span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
160
161
162
163
164
165
166
167
168
169
170
171</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r/mixin/ruby_stdlib.rb', line 160</span>
<span class='def def kw'>def</span> <span class='include_range? fid id'>include_range?</span> <span class='other_range identifier id'>other_range</span>
<span class='case case kw'>case</span> <span class='other_range identifier id'>other_range</span>
<span class='when when kw'>when</span> <span class='Range constant id'>Range</span>
<span class='if if kw'>if</span> <span class='other_range identifier id'>other_range</span><span class='dot token'>.</span><span class='first identifier id'>first</span> <span class='geq op'>>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='first identifier id'>first</span> <span class='andop op'>&&</span> <span class='other_range identifier id'>other_range</span><span class='dot token'>.</span><span class='last identifier id'>last</span> <span class='leq op'><=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='last identifier id'>last</span>
<span class='return return kw'>return</span> <span class='true true kw'>true</span>
<span class='else else kw'>else</span>
<span class='return return kw'>return</span> <span class='false false kw'>false</span>
<span class='end end kw'>end</span>
<span class='else else kw'>else</span>
<span class='raise identifier id'>raise</span> <span class='string val'>"unsupported type"</span>
<span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
<div class="method_details " id="size-instance_method">
<p class="signature "">
- (<tt><a href="Object.html" target="_self" title="Object (class)">Object</a></tt>) <strong>size</strong>
</p><div class="docstring">
<div class="discussion">
<p>
The Range’s computed size, ie the number of elements in range.
</p>
</div>
</div>
<div class="tags">
<div class="examples">
<h3>Examples:</h3>
<h4><div class='inline'></div></h4>
<pre class="example code"><span class='lparen token'>(</span><span class='float val'>3</span><span class='dot2 op'>..</span><span class='integer val'>3</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='size identifier id'>size</span>
<span class='assign token'>=</span><span class='gt op'>></span> <span class='integer val'>1</span>
<span class='lparen token'>(</span><span class='integer val'>0</span><span class='dot2 op'>..</span><span class='integer val'>9</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='size identifier id'>size</span>
<span class='assign token'>=</span><span class='gt op'>></span> <span class='integer val'>10</span>
</pre>
</div>
<h3>Returns:</h3>
<ul class="return">
<li>
<span class='type'></span>
<div class='inline'><p>
The size of the range
</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
125
126
127</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/plist4r/mixin/ruby_stdlib.rb', line 125</span>
<span class='def def kw'>def</span> <span class='size identifier id'>size</span>
<span class='last identifier id'>last</span> <span class='minus op'>-</span> <span class='first identifier id'>first</span> <span class='plus op'>+</span> <span class='integer val'>1</span>
<span class='end end kw'>end</span>
</pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Jul 29 10:50:43 2010 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
0.5.8 and the
<a href="http://github.com/dreamcat4/yard-slipstream">yard-slipstream</a> plugin
(ruby-1.8.7).
</div>
</body>
</html>