dirtravel 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = Version history
2
2
 
3
+ [0.0.5] Abspath as Travel data member.
4
+
3
5
  [0.0.4] Fix for relative path conversion in Travel.filetree.
4
6
 
5
7
  [0.0.3] Entry#tip, Entry#relative?, Entry#rename methods added. New
@@ -137,7 +137,7 @@
137
137
  <li class="public ">
138
138
  <span class="summary_signature">
139
139
 
140
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (DirEntry) <strong>initialize</strong>(name, root = false) </a>
140
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (DirEntry) <strong>initialize</strong>(name, abspath = nil) </a>
141
141
 
142
142
 
143
143
 
@@ -181,7 +181,7 @@
181
181
  <div class="method_details first">
182
182
  <h3 class="signature first" id="initialize-instance_method">
183
183
 
184
- - (<tt><span class='object_link'><a href="" title="DirTravel::DirEntry (class)">DirEntry</a></span></tt>) <strong>initialize</strong>(name, root = false)
184
+ - (<tt><span class='object_link'><a href="" title="DirTravel::DirEntry (class)">DirEntry</a></span></tt>) <strong>initialize</strong>(name, abspath = nil)
185
185
 
186
186
 
187
187
 
@@ -217,18 +217,18 @@
217
217
 
218
218
  <li>
219
219
 
220
- <span class='name'>root</span>
220
+ <span class='name'>abspath</span>
221
221
 
222
222
 
223
- <span class='type'>(<tt>Boolean</tt>)</span>
223
+ <span class='type'>(<tt>String</tt>)</span>
224
224
 
225
225
 
226
- <em class="default">(defaults to: <tt>false</tt>)</em>
226
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
227
227
 
228
228
 
229
229
  &mdash;
230
230
  <div class='inline'>
231
- <p>If root, abspath is set now.</p>
231
+ <p>Set abspath if given.</p>
232
232
  </div>
233
233
 
234
234
  </li>
@@ -247,23 +247,15 @@
247
247
  167
248
248
  168
249
249
  169
250
- 170
251
- 171
252
- 172
253
- 173
254
- 174</pre>
250
+ 170</pre>
255
251
  </td>
256
252
  <td>
257
253
  <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 165</span>
258
254
 
259
- <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='comma'>,</span> <span class='id identifier rubyid_root'>root</span> <span class='op'>=</span> <span class='kw'>false</span> <span class='rparen'>)</span>
255
+ <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='comma'>,</span> <span class='id identifier rubyid_abspath'>abspath</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
260
256
  <span class='kw'>super</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
261
- <span class='kw'>if</span> <span class='id identifier rubyid_root'>root</span>
262
- <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</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>
263
- <span class='ivar'>@abspath</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
264
- <span class='kw'>else</span>
265
- <span class='ivar'>@abspath</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</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='op'>+</span> <span class='id identifier rubyid_name'>name</span>
266
- <span class='kw'>end</span>
257
+ <span class='kw'>if</span> <span class='id identifier rubyid_abspath'>abspath</span>
258
+ <span class='ivar'>@abspath</span> <span class='op'>=</span> <span class='id identifier rubyid_abspath'>abspath</span>
267
259
  <span class='kw'>end</span>
268
260
  <span class='kw'>end</span></pre>
269
261
  </td>
@@ -277,7 +269,7 @@
277
269
  </div>
278
270
 
279
271
  <div id="footer">
280
- Generated on Thu Jan 23 17:38:44 2014 by
272
+ Generated on Thu Jan 23 19:01:13 2014 by
281
273
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
282
274
  0.8.6.1 (ruby-1.9.3).
283
275
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Thu Jan 23 17:38:44 2014 by
117
+ Generated on Thu Jan 23 19:01:13 2014 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.8.6.1 (ruby-1.9.3).
120
120
  </div>
@@ -1233,7 +1233,7 @@
1233
1233
  </div>
1234
1234
 
1235
1235
  <div id="footer">
1236
- Generated on Thu Jan 23 17:38:44 2014 by
1236
+ Generated on Thu Jan 23 19:01:13 2014 by
1237
1237
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1238
1238
  0.8.6.1 (ruby-1.9.3).
1239
1239
  </div>
@@ -267,14 +267,14 @@
267
267
  <pre class="lines">
268
268
 
269
269
 
270
- 183
271
- 184
272
- 185
273
- 186
274
- 187</pre>
270
+ 179
271
+ 180
272
+ 181
273
+ 182
274
+ 183</pre>
275
275
  </td>
276
276
  <td>
277
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 183</span>
277
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 179</span>
278
278
 
279
279
  <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
280
  <span class='kw'>super</span><span class='lparen'>(</span> <span class='id identifier rubyid_name'>name</span> <span class='rparen'>)</span>
@@ -319,12 +319,12 @@
319
319
  <pre class="lines">
320
320
 
321
321
 
322
- 181
323
- 182
324
- 183</pre>
322
+ 177
323
+ 178
324
+ 179</pre>
325
325
  </td>
326
326
  <td>
327
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 181</span>
327
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 177</span>
328
328
 
329
329
  <span class='kw'>def</span> <span class='id identifier rubyid_basename'>basename</span>
330
330
  <span class='ivar'>@basename</span>
@@ -362,12 +362,12 @@
362
362
  <pre class="lines">
363
363
 
364
364
 
365
- 181
366
- 182
367
- 183</pre>
365
+ 177
366
+ 178
367
+ 179</pre>
368
368
  </td>
369
369
  <td>
370
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 181</span>
370
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 177</span>
371
371
 
372
372
  <span class='kw'>def</span> <span class='id identifier rubyid_suffix'>suffix</span>
373
373
  <span class='ivar'>@suffix</span>
@@ -383,7 +383,7 @@
383
383
  </div>
384
384
 
385
385
  <div id="footer">
386
- Generated on Thu Jan 23 17:38:44 2014 by
386
+ Generated on Thu Jan 23 19:01:13 2014 by
387
387
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
388
388
  0.8.6.1 (ruby-1.9.3).
389
389
  </div>
@@ -137,6 +137,33 @@ with suffix and modify tree building with options Hash (see below).</p>
137
137
  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
138
138
  <ul class="summary">
139
139
 
140
+ <li class="public ">
141
+ <span class="summary_signature">
142
+
143
+ <a href="#abspath-instance_method" title="#abspath (instance method)">- (Object) <strong>abspath</strong> </a>
144
+
145
+
146
+
147
+ </span>
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+ <span class="summary_desc"><div class='inline'>
161
+ <p>Returns the value of attribute abspath.</p>
162
+ </div></span>
163
+
164
+ </li>
165
+
166
+
140
167
  <li class="public ">
141
168
  <span class="summary_signature">
142
169
 
@@ -267,7 +294,7 @@ with suffix and modify tree building with options Hash (see below).</p>
267
294
  <li class="public ">
268
295
  <span class="summary_signature">
269
296
 
270
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Travel) <strong>initialize</strong>(basedir = '.', options = {}) </a>
297
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Travel) <strong>initialize</strong>(basedir, abspath, options = {}) </a>
271
298
 
272
299
 
273
300
 
@@ -323,7 +350,7 @@ with suffix and modify tree building with options Hash (see below).</p>
323
350
  <div class="method_details first">
324
351
  <h3 class="signature first" id="initialize-instance_method">
325
352
 
326
- - (<tt><span class='object_link'><a href="" title="DirTravel::Travel (class)">Travel</a></span></tt>) <strong>initialize</strong>(basedir = '.', options = {})
353
+ - (<tt><span class='object_link'><a href="" title="DirTravel::Travel (class)">Travel</a></span></tt>) <strong>initialize</strong>(basedir, abspath, options = {})
327
354
 
328
355
 
329
356
 
@@ -346,27 +373,28 @@ with suffix and modify tree building with options Hash (see below).</p>
346
373
  <pre class="lines">
347
374
 
348
375
 
349
- 244
350
- 245
351
- 246
352
- 247
353
- 248
354
- 249
355
- 250
356
- 251
357
- 252
358
- 253
359
- 254
360
- 255
361
376
  256
362
377
  257
363
- 258</pre>
378
+ 258
379
+ 259
380
+ 260
381
+ 261
382
+ 262
383
+ 263
384
+ 264
385
+ 265
386
+ 266
387
+ 267
388
+ 268
389
+ 269
390
+ 270</pre>
364
391
  </td>
365
392
  <td>
366
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 244</span>
393
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 256</span>
367
394
 
368
- <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='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>
395
+ <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>
369
396
  <span class='ivar'>@basedir</span> <span class='op'>=</span> <span class='id identifier rubyid_basedir'>basedir</span>
397
+ <span class='ivar'>@abspath</span> <span class='op'>=</span> <span class='id identifier rubyid_abspath'>abspath</span>
370
398
 
371
399
  <span class='ivar'>@defaults</span> <span class='op'>=</span> <span class='lbrace'>{</span>
372
400
  <span class='symbol'>:suffix</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span>
@@ -377,8 +405,7 @@ with suffix and modify tree building with options Hash (see below).</p>
377
405
 
378
406
  <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>
379
407
 
380
- <span class='ivar'>@root</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_clean'>clean</span><span class='lparen'>(</span> <span class='ivar'>@basedir</span> <span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>true</span> <span class='rparen'>)</span>
381
-
408
+ <span class='ivar'>@root</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_basedir'>basedir</span><span class='comma'>,</span> <span class='id identifier rubyid_abspath'>abspath</span> <span class='rparen'>)</span>
382
409
  <span class='kw'>end</span></pre>
383
410
  </td>
384
411
  </tr>
@@ -391,9 +418,52 @@ with suffix and modify tree building with options Hash (see below).</p>
391
418
  <h2>Instance Attribute Details</h2>
392
419
 
393
420
 
394
- <span id="basedir=-instance_method"></span>
421
+ <span id="abspath=-instance_method"></span>
395
422
  <div class="method_details first">
396
- <h3 class="signature first" id="basedir-instance_method">
423
+ <h3 class="signature first" id="abspath-instance_method">
424
+
425
+ - (<tt>Object</tt>) <strong>abspath</strong>
426
+
427
+
428
+
429
+
430
+
431
+ </h3><div class="docstring">
432
+ <div class="discussion">
433
+
434
+ <p>Returns the value of attribute abspath</p>
435
+
436
+
437
+ </div>
438
+ </div>
439
+ <div class="tags">
440
+
441
+
442
+ </div><table class="source_code">
443
+ <tr>
444
+ <td>
445
+ <pre class="lines">
446
+
447
+
448
+ 215
449
+ 216
450
+ 217</pre>
451
+ </td>
452
+ <td>
453
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 215</span>
454
+
455
+ <span class='kw'>def</span> <span class='id identifier rubyid_abspath'>abspath</span>
456
+ <span class='ivar'>@abspath</span>
457
+ <span class='kw'>end</span></pre>
458
+ </td>
459
+ </tr>
460
+ </table>
461
+ </div>
462
+
463
+
464
+ <span id="basedir=-instance_method"></span>
465
+ <div class="method_details ">
466
+ <h3 class="signature " id="basedir-instance_method">
397
467
 
398
468
  - (<tt>Object</tt>) <strong>basedir</strong>
399
469
 
@@ -404,7 +474,7 @@ with suffix and modify tree building with options Hash (see below).</p>
404
474
  </h3><div class="docstring">
405
475
  <div class="discussion">
406
476
 
407
- <p>Starting directory for Travel</p>
477
+ <p>Starting directory for Travel.</p>
408
478
 
409
479
 
410
480
  </div>
@@ -418,12 +488,12 @@ with suffix and modify tree building with options Hash (see below).</p>
418
488
  <pre class="lines">
419
489
 
420
490
 
421
- 218
422
- 219
423
- 220</pre>
491
+ 214
492
+ 215
493
+ 216</pre>
424
494
  </td>
425
495
  <td>
426
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 218</span>
496
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 214</span>
427
497
 
428
498
  <span class='kw'>def</span> <span class='id identifier rubyid_basedir'>basedir</span>
429
499
  <span class='ivar'>@basedir</span>
@@ -461,12 +531,12 @@ with suffix and modify tree building with options Hash (see below).</p>
461
531
  <pre class="lines">
462
532
 
463
533
 
464
- 215
465
- 216
466
- 217</pre>
534
+ 211
535
+ 212
536
+ 213</pre>
467
537
  </td>
468
538
  <td>
469
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 215</span>
539
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 211</span>
470
540
 
471
541
  <span class='kw'>def</span> <span class='id identifier rubyid_defaults'>defaults</span>
472
542
  <span class='ivar'>@defaults</span>
@@ -504,12 +574,12 @@ with suffix and modify tree building with options Hash (see below).</p>
504
574
  <pre class="lines">
505
575
 
506
576
 
507
- 212
508
- 213
509
- 214</pre>
577
+ 208
578
+ 209
579
+ 210</pre>
510
580
  </td>
511
581
  <td>
512
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 212</span>
582
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 208</span>
513
583
 
514
584
  <span class='kw'>def</span> <span class='id identifier rubyid_root'>root</span>
515
585
  <span class='ivar'>@root</span>
@@ -610,6 +680,9 @@ with suffix and modify tree building with options Hash (see below).</p>
610
680
  <pre class="lines">
611
681
 
612
682
 
683
+ 221
684
+ 222
685
+ 223
613
686
  224
614
687
  225
615
688
  226
@@ -627,28 +700,55 @@ with suffix and modify tree building with options Hash (see below).</p>
627
700
  238
628
701
  239
629
702
  240
630
- 241</pre>
703
+ 241
704
+ 242
705
+ 243
706
+ 244
707
+ 245
708
+ 246
709
+ 247
710
+ 248
711
+ 249
712
+ 250
713
+ 251
714
+ 252
715
+ 253</pre>
631
716
  </td>
632
717
  <td>
633
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 224</span>
718
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 221</span>
634
719
 
635
720
  <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>
636
721
 
637
- <span class='id identifier rubyid_r'>r</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_options'>options</span> <span class='rparen'>)</span>
638
- <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_travel'>travel</span>
722
+ <span class='id identifier rubyid_pwd'>pwd</span> <span class='op'>=</span> <span class='kw'>nil</span>
723
+
724
+ <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>
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>
726
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_travel'>travel</span>
727
+ <span class='kw'>else</span>
728
+ <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>
729
+ <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
+ <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
+ <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
+ <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>
733
+ <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
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_travel'>travel</span>
735
+ <span class='kw'>end</span>
639
736
 
640
- <span class='kw'>if</span> <span class='id identifier rubyid_r'>r</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>
641
- <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_dirname'>dirname</span><span class='lparen'>(</span> <span class='id identifier rubyid_r'>r</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>
642
- <span class='kw'>if</span> <span class='id identifier rubyid_r'>r</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>
643
- <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_path'>path</span> <span class='rparen'>)</span>
737
+ <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
+ <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>
739
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_uppath'>uppath</span>
740
+ <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
+ <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>
644
742
  <span class='kw'>end</span>
645
- <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='kw'>true</span> <span class='rparen'>)</span>
646
- <span class='id identifier rubyid_r'>r</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_r'>r</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>
647
- <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_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span> <span class='rparen'>)</span>
648
- <span class='id identifier rubyid_r'>r</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>
743
+ <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>
744
+ <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>
745
+ <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>
746
+ <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>
649
747
  <span class='kw'>end</span>
650
748
 
651
- <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span>
749
+ <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
+
751
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_root'>root</span>
652
752
  <span class='kw'>end</span></pre>
653
753
  </td>
654
754
  </tr>
@@ -687,12 +787,12 @@ with suffix and modify tree building with options Hash (see below).</p>
687
787
  <pre class="lines">
688
788
 
689
789
 
690
- 263
691
- 264
692
- 265</pre>
790
+ 275
791
+ 276
792
+ 277</pre>
693
793
  </td>
694
794
  <td>
695
- <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 263</span>
795
+ <pre class="code"><span class="info file"># File 'lib/dirtravel.rb', line 275</span>
696
796
 
697
797
  <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>
698
798
  <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>
@@ -707,7 +807,7 @@ with suffix and modify tree building with options Hash (see below).</p>
707
807
  </div>
708
808
 
709
809
  <div id="footer">
710
- Generated on Thu Jan 23 17:38:45 2014 by
810
+ Generated on Thu Jan 23 19:01:13 2014 by
711
811
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
712
812
  0.8.6.1 (ruby-1.9.3).
713
813
  </div>
data/doc/DirTravel.html CHANGED
@@ -149,7 +149,7 @@ directory hierachy.</p>
149
149
  </div>
150
150
 
151
151
  <div id="footer">
152
- Generated on Thu Jan 23 17:38:44 2014 by
152
+ Generated on Thu Jan 23 19:01:13 2014 by
153
153
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
154
  0.8.6.1 (ruby-1.9.3).
155
155
  </div>
data/doc/_index.html CHANGED
@@ -163,7 +163,7 @@
163
163
  </div>
164
164
 
165
165
  <div id="footer">
166
- Generated on Thu Jan 23 17:38:44 2014 by
166
+ Generated on Thu Jan 23 19:01:13 2014 by
167
167
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
168
168
  0.8.6.1 (ruby-1.9.3).
169
169
  </div>
@@ -63,7 +63,10 @@
63
63
 
64
64
  <div id="content"><div id='filecontents'>
65
65
  <h1>Version history</h1>
66
- <dl class="rdoc-list"><dt>0.0.4</dt>
66
+ <dl class="rdoc-list"><dt>0.0.5</dt>
67
+ <dd>
68
+ <p>Abspath as Travel data member.</p>
69
+ </dd><dt>0.0.4</dt>
67
70
  <dd>
68
71
  <p>Fix for relative path conversion in Travel.filetree.</p>
69
72
  </dd><dt>0.0.3</dt>
@@ -80,7 +83,7 @@ Travel.filetree, :inclusive. It uses one-up directory as root.</p>
80
83
  </div></div>
81
84
 
82
85
  <div id="footer">
83
- Generated on Thu Jan 23 17:38:44 2014 by
86
+ Generated on Thu Jan 23 19:01:13 2014 by
84
87
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
85
88
  0.8.6.1 (ruby-1.9.3).
86
89
  </div>
data/doc/file.README.html CHANGED
@@ -75,7 +75,7 @@ structure. This structure can be conveniently accessed in various ways.</p>
75
75
  </div></div>
76
76
 
77
77
  <div id="footer">
78
- Generated on Thu Jan 23 17:38:44 2014 by
78
+ Generated on Thu Jan 23 19:01:13 2014 by
79
79
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
80
80
  0.8.6.1 (ruby-1.9.3).
81
81
  </div>
data/doc/index.html CHANGED
@@ -75,7 +75,7 @@ structure. This structure can be conveniently accessed in various ways.</p>
75
75
  </div></div>
76
76
 
77
77
  <div id="footer">
78
- Generated on Thu Jan 23 17:38:44 2014 by
78
+ Generated on Thu Jan 23 19:01:13 2014 by
79
79
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
80
80
  0.8.6.1 (ruby-1.9.3).
81
81
  </div>
data/doc/method_list.html CHANGED
@@ -47,138 +47,144 @@
47
47
 
48
48
 
49
49
  <li class="r1 ">
50
+ <span class='object_link'><a href="DirTravel/Travel.html#abspath-instance_method" title="DirTravel::Travel#abspath (method)">#abspath</a></span>
51
+ <small>DirTravel::Travel</small>
52
+ </li>
53
+
54
+
55
+ <li class="r2 ">
50
56
  <span class='object_link'><a href="DirTravel/Entry.html#abspath-instance_method" title="DirTravel::Entry#abspath (method)">#abspath</a></span>
51
57
  <small>DirTravel::Entry</small>
52
58
  </li>
53
59
 
54
60
 
55
- <li class="r2 ">
61
+ <li class="r1 ">
56
62
  <span class='object_link'><a href="DirTravel/Travel.html#basedir-instance_method" title="DirTravel::Travel#basedir (method)">#basedir</a></span>
57
63
  <small>DirTravel::Travel</small>
58
64
  </li>
59
65
 
60
66
 
61
- <li class="r1 ">
67
+ <li class="r2 ">
62
68
  <span class='object_link'><a href="DirTravel/FileEntry.html#basename-instance_method" title="DirTravel::FileEntry#basename (method)">#basename</a></span>
63
69
  <small>DirTravel::FileEntry</small>
64
70
  </li>
65
71
 
66
72
 
67
- <li class="r2 ">
73
+ <li class="r1 ">
68
74
  <span class='object_link'><a href="DirTravel/Travel.html#defaults-instance_method" title="DirTravel::Travel#defaults (method)">#defaults</a></span>
69
75
  <small>DirTravel::Travel</small>
70
76
  </li>
71
77
 
72
78
 
73
- <li class="r1 ">
79
+ <li class="r2 ">
74
80
  <span class='object_link'><a href="DirTravel/Entry.html#dir-instance_method" title="DirTravel::Entry#dir (method)">#dir</a></span>
75
81
  <small>DirTravel::Entry</small>
76
82
  </li>
77
83
 
78
84
 
79
- <li class="r2 ">
85
+ <li class="r1 ">
80
86
  <span class='object_link'><a href="DirTravel/Entry.html#files-instance_method" title="DirTravel::Entry#files (method)">#files</a></span>
81
87
  <small>DirTravel::Entry</small>
82
88
  </li>
83
89
 
84
90
 
85
- <li class="r1 ">
91
+ <li class="r2 ">
86
92
  <span class='object_link'><a href="DirTravel/Travel.html#filetree-class_method" title="DirTravel::Travel.filetree (method)">filetree</a></span>
87
93
  <small>DirTravel::Travel</small>
88
94
  </li>
89
95
 
90
96
 
91
- <li class="r2 ">
92
- <span class='object_link'><a href="DirTravel/FileEntry.html#initialize-instance_method" title="DirTravel::FileEntry#initialize (method)">#initialize</a></span>
93
- <small>DirTravel::FileEntry</small>
94
- </li>
95
-
96
-
97
97
  <li class="r1 ">
98
- <span class='object_link'><a href="DirTravel/Entry.html#initialize-instance_method" title="DirTravel::Entry#initialize (method)">#initialize</a></span>
99
- <small>DirTravel::Entry</small>
98
+ <span class='object_link'><a href="DirTravel/Travel.html#initialize-instance_method" title="DirTravel::Travel#initialize (method)">#initialize</a></span>
99
+ <small>DirTravel::Travel</small>
100
100
  </li>
101
101
 
102
102
 
103
103
  <li class="r2 ">
104
- <span class='object_link'><a href="DirTravel/Travel.html#initialize-instance_method" title="DirTravel::Travel#initialize (method)">#initialize</a></span>
105
- <small>DirTravel::Travel</small>
104
+ <span class='object_link'><a href="DirTravel/DirEntry.html#initialize-instance_method" title="DirTravel::DirEntry#initialize (method)">#initialize</a></span>
105
+ <small>DirTravel::DirEntry</small>
106
106
  </li>
107
107
 
108
108
 
109
109
  <li class="r1 ">
110
- <span class='object_link'><a href="DirTravel/DirEntry.html#initialize-instance_method" title="DirTravel::DirEntry#initialize (method)">#initialize</a></span>
111
- <small>DirTravel::DirEntry</small>
110
+ <span class='object_link'><a href="DirTravel/FileEntry.html#initialize-instance_method" title="DirTravel::FileEntry#initialize (method)">#initialize</a></span>
111
+ <small>DirTravel::FileEntry</small>
112
112
  </li>
113
113
 
114
114
 
115
115
  <li class="r2 ">
116
- <span class='object_link'><a href="DirTravel/Entry.html#name-instance_method" title="DirTravel::Entry#name (method)">#name</a></span>
116
+ <span class='object_link'><a href="DirTravel/Entry.html#initialize-instance_method" title="DirTravel::Entry#initialize (method)">#initialize</a></span>
117
117
  <small>DirTravel::Entry</small>
118
118
  </li>
119
119
 
120
120
 
121
121
  <li class="r1 ">
122
- <span class='object_link'><a href="DirTravel/Entry.html#parts-instance_method" title="DirTravel::Entry#parts (method)">#parts</a></span>
122
+ <span class='object_link'><a href="DirTravel/Entry.html#name-instance_method" title="DirTravel::Entry#name (method)">#name</a></span>
123
123
  <small>DirTravel::Entry</small>
124
124
  </li>
125
125
 
126
126
 
127
127
  <li class="r2 ">
128
- <span class='object_link'><a href="DirTravel/Entry.html#path-instance_method" title="DirTravel::Entry#path (method)">#path</a></span>
128
+ <span class='object_link'><a href="DirTravel/Entry.html#parts-instance_method" title="DirTravel::Entry#parts (method)">#parts</a></span>
129
129
  <small>DirTravel::Entry</small>
130
130
  </li>
131
131
 
132
132
 
133
133
  <li class="r1 ">
134
- <span class='object_link'><a href="DirTravel/Entry.html#relative%3F-instance_method" title="DirTravel::Entry#relative? (method)">#relative?</a></span>
134
+ <span class='object_link'><a href="DirTravel/Entry.html#path-instance_method" title="DirTravel::Entry#path (method)">#path</a></span>
135
135
  <small>DirTravel::Entry</small>
136
136
  </li>
137
137
 
138
138
 
139
139
  <li class="r2 ">
140
- <span class='object_link'><a href="DirTravel/Entry.html#rename-instance_method" title="DirTravel::Entry#rename (method)">#rename</a></span>
140
+ <span class='object_link'><a href="DirTravel/Entry.html#relative%3F-instance_method" title="DirTravel::Entry#relative? (method)">#relative?</a></span>
141
141
  <small>DirTravel::Entry</small>
142
142
  </li>
143
143
 
144
144
 
145
145
  <li class="r1 ">
146
+ <span class='object_link'><a href="DirTravel/Entry.html#rename-instance_method" title="DirTravel::Entry#rename (method)">#rename</a></span>
147
+ <small>DirTravel::Entry</small>
148
+ </li>
149
+
150
+
151
+ <li class="r2 ">
146
152
  <span class='object_link'><a href="DirTravel/Travel.html#root-instance_method" title="DirTravel::Travel#root (method)">#root</a></span>
147
153
  <small>DirTravel::Travel</small>
148
154
  </li>
149
155
 
150
156
 
151
- <li class="r2 ">
157
+ <li class="r1 ">
152
158
  <span class='object_link'><a href="DirTravel/Entry.html#select_level-instance_method" title="DirTravel::Entry#select_level (method)">#select_level</a></span>
153
159
  <small>DirTravel::Entry</small>
154
160
  </li>
155
161
 
156
162
 
157
- <li class="r1 ">
163
+ <li class="r2 ">
158
164
  <span class='object_link'><a href="DirTravel/Entry.html#stat-instance_method" title="DirTravel::Entry#stat (method)">#stat</a></span>
159
165
  <small>DirTravel::Entry</small>
160
166
  </li>
161
167
 
162
168
 
163
- <li class="r2 ">
169
+ <li class="r1 ">
164
170
  <span class='object_link'><a href="DirTravel/Entry.html#subpath-instance_method" title="DirTravel::Entry#subpath (method)">#subpath</a></span>
165
171
  <small>DirTravel::Entry</small>
166
172
  </li>
167
173
 
168
174
 
169
- <li class="r1 ">
175
+ <li class="r2 ">
170
176
  <span class='object_link'><a href="DirTravel/FileEntry.html#suffix-instance_method" title="DirTravel::FileEntry#suffix (method)">#suffix</a></span>
171
177
  <small>DirTravel::FileEntry</small>
172
178
  </li>
173
179
 
174
180
 
175
- <li class="r2 ">
181
+ <li class="r1 ">
176
182
  <span class='object_link'><a href="DirTravel/Entry.html#tip-instance_method" title="DirTravel::Entry#tip (method)">#tip</a></span>
177
183
  <small>DirTravel::Entry</small>
178
184
  </li>
179
185
 
180
186
 
181
- <li class="r1 ">
187
+ <li class="r2 ">
182
188
  <span class='object_link'><a href="DirTravel/Travel.html#travel-instance_method" title="DirTravel::Travel#travel (method)">#travel</a></span>
183
189
  <small>DirTravel::Travel</small>
184
190
  </li>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Thu Jan 23 17:38:44 2014 by
106
+ Generated on Thu Jan 23 19:01:13 2014 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.6.1 (ruby-1.9.3).
109
109
  </div>
data/lib/dirtravel.rb CHANGED
@@ -161,15 +161,11 @@ module DirTravel
161
161
  # Instantiate.
162
162
  #
163
163
  # @param name [String] Directory name.
164
- # @param root [Boolean] If root, abspath is set now.
165
- def initialize( name, root = false )
164
+ # @param abspath [String] Set abspath if given.
165
+ def initialize( name, abspath = nil )
166
166
  super( name )
167
- if root
168
- if name[0] == '/'
169
- @abspath = name
170
- else
171
- @abspath = Dir.pwd + '/' + name
172
- end
167
+ if abspath
168
+ @abspath = abspath
173
169
  end
174
170
  end
175
171
 
@@ -214,8 +210,9 @@ module DirTravel
214
210
  # Default options for Travel.
215
211
  attr_accessor :defaults
216
212
 
217
- # Starting directory for Travel
213
+ # Starting directory for Travel.
218
214
  attr_accessor :basedir
215
+ attr_accessor :abspath
219
216
 
220
217
  # Create directory recursion tree.
221
218
  # @param basedir [String] Starting directory (top).
@@ -223,26 +220,42 @@ module DirTravel
223
220
  # @return [DirEntry] Root item of the file system hierarchy.
224
221
  def Travel.filetree( basedir = '.', options = {} )
225
222
 
226
- r = Travel.new( basedir, options )
227
- r.travel
223
+ pwd = nil
224
+
225
+ if basedir[0] == '/'
226
+ t = Travel.new( basedir, basedir, options )
227
+ t.travel
228
+ else
229
+ pwd = Dir.pwd
230
+ full = File.absolute_path( basedir )
231
+ base = File.basename( full )
232
+ dir = File.dirname( full )
233
+ Dir.chdir( dir )
234
+ t = Travel.new( base, full, options )
235
+ t.travel
236
+ end
228
237
 
229
- if r.defaults[ :inclusive ]
230
- path = File.dirname( r.root.abspath )
231
- if r.root.relative?
232
- path = File.basename( path )
238
+ if t.defaults[ :inclusive ]
239
+ uppath = File.dirname( t.root.abspath )
240
+ path = uppath
241
+ if t.root.relative?
242
+ path = File.basename( uppath )
233
243
  end
234
- newRoot = DirEntry.new( path, true )
235
- r.root.rename( r.root.tip )
236
- newRoot.add( r.root )
237
- r.root = newRoot
244
+ newRoot = DirEntry.new( path, uppath )
245
+ t.root.rename( t.root.tip )
246
+ newRoot.add( t.root )
247
+ t.root = newRoot
238
248
  end
239
249
 
240
- r.root
250
+ Dir.chdir( pwd ) if pwd
251
+
252
+ t.root
241
253
  end
242
254
 
243
255
 
244
- def initialize( basedir = '.', options = {} )
256
+ def initialize( basedir, abspath, options = {} )
245
257
  @basedir = basedir
258
+ @abspath = abspath
246
259
 
247
260
  @defaults = {
248
261
  :suffix => nil,
@@ -253,8 +266,7 @@ module DirTravel
253
266
 
254
267
  @defaults.merge!( options )
255
268
 
256
- @root = DirEntry.new( clean( @basedir ), true )
257
-
269
+ @root = DirEntry.new( basedir, abspath )
258
270
  end
259
271
 
260
272
 
@@ -267,16 +279,6 @@ module DirTravel
267
279
 
268
280
  private
269
281
 
270
- # Clean relative path head (remove dot etc).
271
- def clean( dir )
272
- if dir[0] == '/'
273
- dir
274
- else
275
- File.basename( File.absolute_path( dir ) )
276
- end
277
- end
278
-
279
-
280
282
  # Recursively get all files with suffix. Ignore suffix if
281
283
  # suffix is nil.
282
284
  def entriesIn( dir, node, suffix = nil )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirtravel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: