dirtravel 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +2 -2
- data/doc/DirTravel.html +105 -20
- data/doc/DirTravel/DirEntry.html +14 -14
- data/doc/DirTravel/DirTravelError.html +15 -4
- data/doc/DirTravel/Entry.html +90 -90
- data/doc/DirTravel/FileEntry.html +40 -20
- data/doc/DirTravel/Travel.html +231 -109
- data/doc/_index.html +5 -5
- data/doc/class_list.html +6 -1
- data/doc/css/style.css +2 -1
- data/doc/file.CHANGELOG.html +14 -11
- data/doc/file.README.html +10 -10
- data/doc/file_list.html +6 -1
- data/doc/frames.html +5 -7
- data/doc/index.html +10 -10
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +9 -6
- data/doc/method_list.html +12 -1
- data/doc/top-level-namespace.html +4 -4
- data/lib/dirtravel.rb +99 -40
- data/lib/version.rb +6 -0
- data/test/test_dirtravel.rb +5 -5
- metadata +34 -31
- data/Rakefile +0 -28
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: DirTravel::FileEntry
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.6
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!"
|
20
|
+
framesUrl = "../frames.html#!DirTravel/FileEntry.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -217,7 +217,7 @@
|
|
217
217
|
|
218
218
|
|
219
219
|
<span class="summary_desc"><div class='inline'>
|
220
|
-
<p>
|
220
|
+
<p>Set name, suffix, and basename.</p>
|
221
221
|
</div></span>
|
222
222
|
|
223
223
|
</li>
|
@@ -253,13 +253,33 @@
|
|
253
253
|
</h3><div class="docstring">
|
254
254
|
<div class="discussion">
|
255
255
|
|
256
|
-
<p>
|
256
|
+
<p>Set name, suffix, and basename.</p>
|
257
257
|
|
258
258
|
|
259
259
|
</div>
|
260
260
|
</div>
|
261
261
|
<div class="tags">
|
262
|
+
<p class="tag_title">Parameters:</p>
|
263
|
+
<ul class="param">
|
262
264
|
|
265
|
+
<li>
|
266
|
+
|
267
|
+
<span class='name'>name</span>
|
268
|
+
|
269
|
+
|
270
|
+
<span class='type'>(<tt>String</tt>)</span>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
—
|
275
|
+
<div class='inline'>
|
276
|
+
<p>File name.</p>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
</li>
|
280
|
+
|
281
|
+
</ul>
|
282
|
+
|
263
283
|
|
264
284
|
</div><table class="source_code">
|
265
285
|
<tr>
|
@@ -267,14 +287,14 @@
|
|
267
287
|
<pre class="lines">
|
268
288
|
|
269
289
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
290
|
+
191
|
291
|
+
192
|
292
|
+
193
|
293
|
+
194
|
294
|
+
195</pre>
|
275
295
|
</td>
|
276
296
|
<td>
|
277
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
297
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 191</span>
|
278
298
|
|
279
299
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
|
280
300
|
<span class='kw'>super</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
|
@@ -319,12 +339,12 @@
|
|
319
339
|
<pre class="lines">
|
320
340
|
|
321
341
|
|
322
|
-
|
323
|
-
|
324
|
-
|
342
|
+
186
|
343
|
+
187
|
344
|
+
188</pre>
|
325
345
|
</td>
|
326
346
|
<td>
|
327
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
347
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 186</span>
|
328
348
|
|
329
349
|
<span class='kw'>def</span> <span class='id identifier rubyid_basename'>basename</span>
|
330
350
|
<span class='ivar'>@basename</span>
|
@@ -362,12 +382,12 @@
|
|
362
382
|
<pre class="lines">
|
363
383
|
|
364
384
|
|
365
|
-
|
366
|
-
|
367
|
-
|
385
|
+
186
|
386
|
+
187
|
387
|
+
188</pre>
|
368
388
|
</td>
|
369
389
|
<td>
|
370
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
390
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 186</span>
|
371
391
|
|
372
392
|
<span class='kw'>def</span> <span class='id identifier rubyid_suffix'>suffix</span>
|
373
393
|
<span class='ivar'>@suffix</span>
|
@@ -383,9 +403,9 @@
|
|
383
403
|
</div>
|
384
404
|
|
385
405
|
<div id="footer">
|
386
|
-
Generated on
|
406
|
+
Generated on Sun Apr 19 15:01:50 2015 by
|
387
407
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
388
|
-
0.8.6
|
408
|
+
0.8.7.6 (ruby-2.1.2).
|
389
409
|
</div>
|
390
410
|
|
391
411
|
</body>
|
data/doc/DirTravel/Travel.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: DirTravel::Travel
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.6
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!"
|
20
|
+
framesUrl = "../frames.html#!DirTravel/Travel.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -102,27 +102,32 @@
|
|
102
102
|
<h2>Overview</h2><div class="docstring">
|
103
103
|
<div class="discussion">
|
104
104
|
|
105
|
-
<p>Create directory recursion tree (with Travel.filetree). Optionally filter
|
105
|
+
<p>Create directory recursion tree (with <span class='object_link'><a href="#filetree-class_method" title="DirTravel::Travel.filetree (method)">Travel.filetree</a></span>). Optionally filter
|
106
106
|
with suffix and modify tree building with options Hash (see below).</p>
|
107
107
|
|
108
|
-
<
|
109
|
-
|
110
|
-
|
108
|
+
<p>If basedir is absolute path, the root name is the search path. If basedir
|
109
|
+
is relative path, before search the current directory is changed to
|
110
|
+
referenced directory and root name is the current directory, single level.</p>
|
111
|
+
|
112
|
+
<h2 id="label-Parameters%3A">Parameters:</h2>
|
113
|
+
<dl class="rdoc-list note-list"><dt>sort
|
114
|
+
<dd>
|
111
115
|
<p>Sort directory entries (default: false).</p>
|
112
|
-
</
|
113
|
-
<
|
114
|
-
<p>Limit search to files with
|
115
|
-
</
|
116
|
-
<
|
116
|
+
</dd><dt>suffix
|
117
|
+
<dd>
|
118
|
+
<p>Limit search to files with “suffix” (default: nil).</p>
|
119
|
+
</dd><dt>files
|
120
|
+
<dd>
|
117
121
|
<p>Include files to search (default: true).</p>
|
118
|
-
</
|
119
|
-
<
|
122
|
+
</dd><dt>inclusive
|
123
|
+
<dd>
|
120
124
|
<p>Basedirs parent becomes the basedir (default: false).</p>
|
121
|
-
</
|
125
|
+
</dd></dl>
|
122
126
|
|
123
127
|
<p>Example:</p>
|
124
128
|
|
125
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_d1'>d1</span> <span class='op'>=</span> <span class='const'>DirTravel</span><span class='op'>::</span><span class='const'>Travel</span><span class='period'>.</span><span class='id identifier rubyid_filetree'>filetree</span><span class='lparen'>(</span> <span class='id identifier rubyid_dir1'>dir1</span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='symbol'>:sort</span> <span class='op'>=></span> <span class='kw'>true</span><span class='comma'>,</span> <span class='symbol'>:suffix</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'
|
129
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_d1'>d1</span> <span class='op'>=</span> <span class='const'>DirTravel</span><span class='op'>::</span><span class='const'>Travel</span><span class='period'>.</span><span class='id identifier rubyid_filetree'>filetree</span><span class='lparen'>(</span> <span class='id identifier rubyid_dir1'>dir1</span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='symbol'>:sort</span> <span class='op'>=></span> <span class='kw'>true</span><span class='comma'>,</span> <span class='symbol'>:suffix</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.mp3</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span> <span class='rparen'>)</span>
|
130
|
+
</code></pre>
|
126
131
|
|
127
132
|
|
128
133
|
</div>
|
@@ -185,7 +190,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
185
190
|
|
186
191
|
|
187
192
|
<span class="summary_desc"><div class='inline'>
|
188
|
-
<p>Starting directory for Travel
|
193
|
+
<p>Starting directory for <span class='object_link'><a href="" title="DirTravel::Travel (class)">Travel</a></span>.</p>
|
189
194
|
</div></span>
|
190
195
|
|
191
196
|
</li>
|
@@ -212,7 +217,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
212
217
|
|
213
218
|
|
214
219
|
<span class="summary_desc"><div class='inline'>
|
215
|
-
<p>Default options for Travel
|
220
|
+
<p>Default options for <span class='object_link'><a href="" title="DirTravel::Travel (class)">Travel</a></span>.</p>
|
216
221
|
</div></span>
|
217
222
|
|
218
223
|
</li>
|
@@ -239,7 +244,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
239
244
|
|
240
245
|
|
241
246
|
<span class="summary_desc"><div class='inline'>
|
242
|
-
<p>Root DirEntry of Travel
|
247
|
+
<p>Root <span class='object_link'><a href="DirEntry.html" title="DirTravel::DirEntry (class)">DirEntry</a></span> of <span class='object_link'><a href="" title="DirTravel::Travel (class)">Travel</a></span>.</p>
|
243
248
|
</div></span>
|
244
249
|
|
245
250
|
</li>
|
@@ -261,7 +266,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
261
266
|
<li class="public ">
|
262
267
|
<span class="summary_signature">
|
263
268
|
|
264
|
-
<a href="#filetree-class_method" title="filetree (class method)">+ (DirEntry) <strong>filetree</strong>(basedir =
|
269
|
+
<a href="#filetree-class_method" title="filetree (class method)">+ (DirEntry) <strong>filetree</strong>(basedir = '.', options = {}) </a>
|
265
270
|
|
266
271
|
|
267
272
|
|
@@ -276,7 +281,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
276
281
|
|
277
282
|
|
278
283
|
<span class="summary_desc"><div class='inline'>
|
279
|
-
<p>Create directory recursion tree.</p>
|
284
|
+
<p>Create directory recursion tree and return root.</p>
|
280
285
|
</div></span>
|
281
286
|
|
282
287
|
</li>
|
@@ -311,7 +316,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
311
316
|
|
312
317
|
|
313
318
|
<span class="summary_desc"><div class='inline'>
|
314
|
-
<p>
|
319
|
+
<p>Create directory recursion object.</p>
|
315
320
|
</div></span>
|
316
321
|
|
317
322
|
</li>
|
@@ -359,13 +364,68 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
359
364
|
</h3><div class="docstring">
|
360
365
|
<div class="discussion">
|
361
366
|
|
362
|
-
<p>
|
367
|
+
<p>Create directory recursion object. Overlay options on top of defaults.
|
368
|
+
Initialize root <span class='object_link'><a href="DirEntry.html" title="DirTravel::DirEntry (class)">DirEntry</a></span>.</p>
|
363
369
|
|
364
370
|
|
365
371
|
</div>
|
366
372
|
</div>
|
367
373
|
<div class="tags">
|
374
|
+
<p class="tag_title">Parameters:</p>
|
375
|
+
<ul class="param">
|
376
|
+
|
377
|
+
<li>
|
378
|
+
|
379
|
+
<span class='name'>basedir</span>
|
380
|
+
|
381
|
+
|
382
|
+
<span class='type'>(<tt>String</tt>)</span>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
—
|
387
|
+
<div class='inline'>
|
388
|
+
<p>Starting directory (top).</p>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
</li>
|
392
|
+
|
393
|
+
<li>
|
394
|
+
|
395
|
+
<span class='name'>abspath</span>
|
396
|
+
|
397
|
+
|
398
|
+
<span class='type'>(<tt>String</tt>)</span>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
—
|
403
|
+
<div class='inline'>
|
404
|
+
<p>Absolute path for root.</p>
|
405
|
+
</div>
|
406
|
+
|
407
|
+
</li>
|
408
|
+
|
409
|
+
<li>
|
410
|
+
|
411
|
+
<span class='name'>options</span>
|
412
|
+
|
413
|
+
|
414
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
415
|
+
|
416
|
+
|
417
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
418
|
+
|
419
|
+
|
420
|
+
—
|
421
|
+
<div class='inline'>
|
422
|
+
<p><span class='object_link'><a href="" title="DirTravel::Travel (class)">DirTravel::Travel</a></span> options.</p>
|
423
|
+
</div>
|
424
|
+
|
425
|
+
</li>
|
368
426
|
|
427
|
+
</ul>
|
428
|
+
|
369
429
|
|
370
430
|
</div><table class="source_code">
|
371
431
|
<tr>
|
@@ -373,35 +433,35 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
373
433
|
<pre class="lines">
|
374
434
|
|
375
435
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
436
|
+
312
|
437
|
+
313
|
438
|
+
314
|
439
|
+
315
|
440
|
+
316
|
441
|
+
317
|
442
|
+
318
|
443
|
+
319
|
444
|
+
320
|
445
|
+
321
|
446
|
+
322
|
447
|
+
323
|
448
|
+
324
|
449
|
+
325
|
450
|
+
326</pre>
|
391
451
|
</td>
|
392
452
|
<td>
|
393
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
453
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 312</span>
|
394
454
|
|
395
455
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span><span class='comma'>,</span> <span class='id identifier rubyid_abspath'>abspath</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='rparen'>)</span>
|
396
456
|
<span class='ivar'>@basedir</span> <span class='op'>=</span> <span class='id identifier rubyid_basedir'>basedir</span>
|
397
457
|
<span class='ivar'>@abspath</span> <span class='op'>=</span> <span class='id identifier rubyid_abspath'>abspath</span>
|
398
458
|
|
399
459
|
<span class='ivar'>@defaults</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
400
|
-
<span class='symbol'>:suffix</span> <span class='op'>=></span> <span class='kw'>nil</span><span class='comma'>,</span>
|
401
|
-
<span class='symbol'>:sort</span> <span class='op'>=></span> <span class='kw'>false</span><span class='comma'>,</span>
|
402
|
-
<span class='symbol'>:files</span> <span class='op'>=></span> <span class='kw'>true</span><span class='comma'>,</span>
|
403
|
-
<span class='symbol'>:inclusive</span> <span class='op'>=></span> <span class='kw'>false</span><span class='comma'>,</span>
|
404
|
-
<span class='rbrace'>}</span>
|
460
|
+
<span class='symbol'>:suffix</span> <span class='op'>=></span> <span class='kw'>nil</span><span class='comma'>,</span>
|
461
|
+
<span class='symbol'>:sort</span> <span class='op'>=></span> <span class='kw'>false</span><span class='comma'>,</span>
|
462
|
+
<span class='symbol'>:files</span> <span class='op'>=></span> <span class='kw'>true</span><span class='comma'>,</span>
|
463
|
+
<span class='symbol'>:inclusive</span> <span class='op'>=></span> <span class='kw'>false</span><span class='comma'>,</span>
|
464
|
+
<span class='rbrace'>}</span>
|
405
465
|
|
406
466
|
<span class='ivar'>@defaults</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span> <span class='id identifier rubyid_options'>options</span> <span class='rparen'>)</span>
|
407
467
|
|
@@ -445,12 +505,12 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
445
505
|
<pre class="lines">
|
446
506
|
|
447
507
|
|
448
|
-
|
449
|
-
|
450
|
-
|
508
|
+
232
|
509
|
+
233
|
510
|
+
234</pre>
|
451
511
|
</td>
|
452
512
|
<td>
|
453
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
513
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 232</span>
|
454
514
|
|
455
515
|
<span class='kw'>def</span> <span class='id identifier rubyid_abspath'>abspath</span>
|
456
516
|
<span class='ivar'>@abspath</span>
|
@@ -474,7 +534,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
474
534
|
</h3><div class="docstring">
|
475
535
|
<div class="discussion">
|
476
536
|
|
477
|
-
<p>Starting directory for Travel
|
537
|
+
<p>Starting directory for <span class='object_link'><a href="" title="DirTravel::Travel (class)">DirTravel::Travel</a></span>.</p>
|
478
538
|
|
479
539
|
|
480
540
|
</div>
|
@@ -488,12 +548,12 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
488
548
|
<pre class="lines">
|
489
549
|
|
490
550
|
|
491
|
-
|
492
|
-
|
493
|
-
|
551
|
+
231
|
552
|
+
232
|
553
|
+
233</pre>
|
494
554
|
</td>
|
495
555
|
<td>
|
496
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
556
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 231</span>
|
497
557
|
|
498
558
|
<span class='kw'>def</span> <span class='id identifier rubyid_basedir'>basedir</span>
|
499
559
|
<span class='ivar'>@basedir</span>
|
@@ -517,7 +577,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
517
577
|
</h3><div class="docstring">
|
518
578
|
<div class="discussion">
|
519
579
|
|
520
|
-
<p>Default options for Travel
|
580
|
+
<p>Default options for <span class='object_link'><a href="" title="DirTravel::Travel (class)">DirTravel::Travel</a></span>.</p>
|
521
581
|
|
522
582
|
|
523
583
|
</div>
|
@@ -531,12 +591,12 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
531
591
|
<pre class="lines">
|
532
592
|
|
533
593
|
|
534
|
-
|
535
|
-
|
536
|
-
|
594
|
+
228
|
595
|
+
229
|
596
|
+
230</pre>
|
537
597
|
</td>
|
538
598
|
<td>
|
539
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
599
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 228</span>
|
540
600
|
|
541
601
|
<span class='kw'>def</span> <span class='id identifier rubyid_defaults'>defaults</span>
|
542
602
|
<span class='ivar'>@defaults</span>
|
@@ -560,7 +620,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
560
620
|
</h3><div class="docstring">
|
561
621
|
<div class="discussion">
|
562
622
|
|
563
|
-
<p>Root DirEntry of Travel
|
623
|
+
<p>Root <span class='object_link'><a href="DirEntry.html" title="DirTravel::DirEntry (class)">DirEntry</a></span> of <span class='object_link'><a href="" title="DirTravel::Travel (class)">DirTravel::Travel</a></span>.</p>
|
564
624
|
|
565
625
|
|
566
626
|
</div>
|
@@ -574,12 +634,12 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
574
634
|
<pre class="lines">
|
575
635
|
|
576
636
|
|
577
|
-
|
578
|
-
|
579
|
-
|
637
|
+
225
|
638
|
+
226
|
639
|
+
227</pre>
|
580
640
|
</td>
|
581
641
|
<td>
|
582
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
642
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 225</span>
|
583
643
|
|
584
644
|
<span class='kw'>def</span> <span class='id identifier rubyid_root'>root</span>
|
585
645
|
<span class='ivar'>@root</span>
|
@@ -599,7 +659,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
599
659
|
<div class="method_details first">
|
600
660
|
<h3 class="signature first" id="filetree-class_method">
|
601
661
|
|
602
|
-
+ (<tt><span class='object_link'><a href="DirEntry.html" title="DirTravel::DirEntry (class)">DirEntry</a></span></tt>) <strong>filetree</strong>(basedir =
|
662
|
+
+ (<tt><span class='object_link'><a href="DirEntry.html" title="DirTravel::DirEntry (class)">DirEntry</a></span></tt>) <strong>filetree</strong>(basedir = '.', options = {})
|
603
663
|
|
604
664
|
|
605
665
|
|
@@ -608,7 +668,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
608
668
|
</h3><div class="docstring">
|
609
669
|
<div class="discussion">
|
610
670
|
|
611
|
-
<p>Create directory recursion tree.</p>
|
671
|
+
<p>Create directory recursion tree and return root.</p>
|
612
672
|
|
613
673
|
|
614
674
|
</div>
|
@@ -625,7 +685,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
625
685
|
<span class='type'>(<tt>String</tt>)</span>
|
626
686
|
|
627
687
|
|
628
|
-
<em class="default">(defaults to: <tt
|
688
|
+
<em class="default">(defaults to: <tt>'.'</tt>)</em>
|
629
689
|
|
630
690
|
|
631
691
|
—
|
@@ -648,7 +708,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
648
708
|
|
649
709
|
—
|
650
710
|
<div class='inline'>
|
651
|
-
<p
|
711
|
+
<p><span class='object_link'><a href="" title="DirTravel::Travel (class)">DirTravel::Travel</a></span> options.</p>
|
652
712
|
</div>
|
653
713
|
|
654
714
|
</li>
|
@@ -667,7 +727,7 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
667
727
|
|
668
728
|
—
|
669
729
|
<div class='inline'>
|
670
|
-
<p>Root
|
730
|
+
<p>Root of the file travel hierarchy.</p>
|
671
731
|
</div>
|
672
732
|
|
673
733
|
</li>
|
@@ -680,25 +740,6 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
680
740
|
<pre class="lines">
|
681
741
|
|
682
742
|
|
683
|
-
221
|
684
|
-
222
|
685
|
-
223
|
686
|
-
224
|
687
|
-
225
|
688
|
-
226
|
689
|
-
227
|
690
|
-
228
|
691
|
-
229
|
692
|
-
230
|
693
|
-
231
|
694
|
-
232
|
695
|
-
233
|
696
|
-
234
|
697
|
-
235
|
698
|
-
236
|
699
|
-
237
|
700
|
-
238
|
701
|
-
239
|
702
743
|
240
|
703
744
|
241
|
704
745
|
242
|
@@ -712,43 +753,124 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
712
753
|
250
|
713
754
|
251
|
714
755
|
252
|
715
|
-
253
|
756
|
+
253
|
757
|
+
254
|
758
|
+
255
|
759
|
+
256
|
760
|
+
257
|
761
|
+
258
|
762
|
+
259
|
763
|
+
260
|
764
|
+
261
|
765
|
+
262
|
766
|
+
263
|
767
|
+
264
|
768
|
+
265
|
769
|
+
266
|
770
|
+
267
|
771
|
+
268
|
772
|
+
269
|
773
|
+
270
|
774
|
+
271
|
775
|
+
272
|
776
|
+
273
|
777
|
+
274
|
778
|
+
275
|
779
|
+
276
|
780
|
+
277
|
781
|
+
278
|
782
|
+
279
|
783
|
+
280
|
784
|
+
281
|
785
|
+
282
|
786
|
+
283
|
787
|
+
284
|
788
|
+
285
|
789
|
+
286
|
790
|
+
287
|
791
|
+
288
|
792
|
+
289
|
793
|
+
290
|
794
|
+
291
|
795
|
+
292
|
796
|
+
293
|
797
|
+
294
|
798
|
+
295
|
799
|
+
296
|
800
|
+
297
|
801
|
+
298
|
802
|
+
299
|
803
|
+
300
|
804
|
+
301
|
805
|
+
302
|
806
|
+
303</pre>
|
716
807
|
</td>
|
717
808
|
<td>
|
718
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
809
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 240</span>
|
810
|
+
|
811
|
+
<span class='kw'>def</span> <span class='const'>Travel</span><span class='period'>.</span><span class='id identifier rubyid_filetree'>filetree</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='rparen'>)</span>
|
719
812
|
|
720
|
-
<span class='
|
813
|
+
<span class='comment'># Non-nil if directory needs to be changed.
|
814
|
+
</span> <span class='id identifier rubyid_pwd'>pwd</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
721
815
|
|
722
|
-
<span class='id identifier
|
816
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_basedir'>basedir</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span>
|
723
817
|
|
724
|
-
|
725
|
-
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='const'>Travel</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span><span class='comma'>,</span> <span class='id identifier rubyid_basedir'>basedir</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='rparen'>)</span>
|
818
|
+
<span class='comment'># Absolue path.
|
819
|
+
</span> <span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='const'>Travel</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span><span class='comma'>,</span> <span class='id identifier rubyid_basedir'>basedir</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='rparen'>)</span>
|
726
820
|
<span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_travel'>travel</span>
|
821
|
+
|
727
822
|
<span class='kw'>else</span>
|
728
|
-
|
729
|
-
<span class='
|
823
|
+
|
824
|
+
<span class='comment'># Relative path.
|
825
|
+
</span>
|
826
|
+
<span class='comment'># Store current directory before chdir.
|
827
|
+
</span> <span class='id identifier rubyid_pwd'>pwd</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</span>
|
828
|
+
|
829
|
+
<span class='comment'># Generate target directory for chdir. One up from
|
830
|
+
</span> <span class='comment'># the reference.
|
831
|
+
</span> <span class='id identifier rubyid_full'>full</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span> <span class='id identifier rubyid_basedir'>basedir</span> <span class='rparen'>)</span>
|
730
832
|
<span class='id identifier rubyid_base'>base</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span> <span class='id identifier rubyid_full'>full</span> <span class='rparen'>)</span>
|
731
833
|
<span class='id identifier rubyid_dir'>dir</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span> <span class='id identifier rubyid_full'>full</span> <span class='rparen'>)</span>
|
732
|
-
|
834
|
+
|
835
|
+
<span class='comment'># Goto target.
|
836
|
+
</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_chdir'>chdir</span><span class='lparen'>(</span> <span class='id identifier rubyid_dir'>dir</span> <span class='rparen'>)</span>
|
837
|
+
|
733
838
|
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='const'>Travel</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span> <span class='id identifier rubyid_base'>base</span><span class='comma'>,</span> <span class='id identifier rubyid_full'>full</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='rparen'>)</span>
|
734
839
|
<span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_travel'>travel</span>
|
735
840
|
<span class='kw'>end</span>
|
736
841
|
|
842
|
+
|
737
843
|
<span class='kw'>if</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_defaults'>defaults</span><span class='lbracket'>[</span> <span class='symbol'>:inclusive</span> <span class='rbracket'>]</span>
|
738
|
-
|
739
|
-
<span class='
|
844
|
+
|
845
|
+
<span class='comment'># With inclusive the root is changed to one-up from
|
846
|
+
</span> <span class='comment'># target.
|
847
|
+
</span>
|
848
|
+
<span class='comment'># One up from root.
|
849
|
+
</span> <span class='id identifier rubyid_uppath'>uppath</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_abspath'>abspath</span> <span class='rparen'>)</span>
|
740
850
|
<span class='kw'>if</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_relative?'>relative?</span>
|
741
851
|
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span> <span class='id identifier rubyid_uppath'>uppath</span> <span class='rparen'>)</span>
|
852
|
+
<span class='kw'>else</span>
|
853
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_uppath'>uppath</span>
|
742
854
|
<span class='kw'>end</span>
|
743
|
-
|
744
|
-
<span class='
|
745
|
-
<span class='id identifier rubyid_newRoot'>newRoot</span><span class='period'>.</span><span class='id identifier
|
746
|
-
|
855
|
+
|
856
|
+
<span class='comment'># Create the "one-up" root.
|
857
|
+
</span> <span class='id identifier rubyid_newRoot'>newRoot</span> <span class='op'>=</span> <span class='const'>DirEntry</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_uppath'>uppath</span> <span class='rparen'>)</span>
|
858
|
+
|
859
|
+
<span class='comment'># Rename old root.
|
860
|
+
</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_rename'>rename</span><span class='lparen'>(</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_tip'>tip</span> <span class='rparen'>)</span>
|
861
|
+
|
862
|
+
<span class='comment'># Add to one-up root.
|
863
|
+
</span> <span class='id identifier rubyid_newRoot'>newRoot</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span> <span class='rparen'>)</span>
|
864
|
+
|
865
|
+
<span class='comment'># Set root to one-up root.
|
866
|
+
</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span> <span class='op'>=</span> <span class='id identifier rubyid_newRoot'>newRoot</span>
|
747
867
|
<span class='kw'>end</span>
|
748
868
|
|
749
|
-
<span class='
|
869
|
+
<span class='comment'># Return back to start directory if dir changed.
|
870
|
+
</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_chdir'>chdir</span><span class='lparen'>(</span> <span class='id identifier rubyid_pwd'>pwd</span> <span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_pwd'>pwd</span>
|
750
871
|
|
751
|
-
<span class='
|
872
|
+
<span class='comment'># Return root {DirEntry}.
|
873
|
+
</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span>
|
752
874
|
<span class='kw'>end</span></pre>
|
753
875
|
</td>
|
754
876
|
</tr>
|
@@ -787,12 +909,12 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
787
909
|
<pre class="lines">
|
788
910
|
|
789
911
|
|
790
|
-
|
791
|
-
|
792
|
-
|
912
|
+
331
|
913
|
+
332
|
914
|
+
333</pre>
|
793
915
|
</td>
|
794
916
|
<td>
|
795
|
-
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line
|
917
|
+
<pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 331</span>
|
796
918
|
|
797
919
|
<span class='kw'>def</span> <span class='id identifier rubyid_travel'>travel</span><span class='lparen'>(</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='op'>=</span> <span class='ivar'>@defaults</span><span class='lbracket'>[</span> <span class='symbol'>:suffix</span> <span class='rbracket'>]</span> <span class='rparen'>)</span>
|
798
920
|
<span class='id identifier rubyid_entriesIn'>entriesIn</span><span class='lparen'>(</span> <span class='ivar'>@basedir</span><span class='comma'>,</span> <span class='ivar'>@root</span><span class='comma'>,</span> <span class='id identifier rubyid_suffix'>suffix</span> <span class='rparen'>)</span>
|
@@ -807,9 +929,9 @@ with suffix and modify tree building with options Hash (see below).</p>
|
|
807
929
|
</div>
|
808
930
|
|
809
931
|
<div id="footer">
|
810
|
-
Generated on
|
932
|
+
Generated on Sun Apr 19 15:01:50 2015 by
|
811
933
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
812
|
-
0.8.6
|
934
|
+
0.8.7.6 (ruby-2.1.2).
|
813
935
|
</div>
|
814
936
|
|
815
937
|
</body>
|