File: ref_m_filetest.xml

package info (click to toggle)
rubybook 0.2.1-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k, lenny, squeeze, wheezy
  • size: 4,248 kB
  • ctags: 1,042
  • sloc: xml: 60,486; makefile: 25
file content (509 lines) | stat: -rw-r--r-- 13,584 bytes parent folder | download | duplicates (3)
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
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
<ppdoc>
<copyright>
    Copyright (c) 2001 by Addison Wesley Longman.  This
    material may be distributed only subject to the terms and
    conditions set forth in the Open Publication License, v1.0 or
    later (the latest version is presently available at
    http://www.opencontent.org/openpub/).
</copyright>
<class name="FileTest" type="module">
<p/>
  <modulename>FileTest</modulename> implements file test operations similar to those used
  in <classname>File::Stat</classname>.
<p/>
  <methods type="instance">
        <method name="blockdev?" ref="blockdev_qm">
      <callseq>
        FileTest.blockdev?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is a block device, <const>false</const>
      if it isn't or 
      if the operating system doesn't support this feature.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.blockdev?( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.blockdev?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="chardev?" ref="chardev_qm">
      <callseq>
        FileTest.chardev?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is a character device, <const>false</const>
      if it isn't or 
      if the operating system doesn't support this feature.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.chardev?( "/dev/tty" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.chardev?(<nbsp/>"/dev/tty"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="directory?" ref="directory_qm">
      <callseq>
        FileTest.directory?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if this named file is a directory, <const>false</const> 
      otherwise.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.directory?( "." )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.directory?(<nbsp/>"."<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="executable?" ref="executable_qm">
      <callseq>
        FileTest.executable?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is executable.
      The tests are made using the effective
      owner of the process.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.executable?( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.executable?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="executable_real?" ref="executable_real_qm">
      <callseq>
        FileTest.executable_real?( <obj>aString</obj> )
    <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Same as <mim><file>filetest</file><front>FileTest</front><back>executable?</back><mref>executable_qm</mref></mim>, but tests using the real owner of the
      process.
<p/>
      </desc>
    </method>
<p/>
        <method name="exist?" ref="exist_qm">
      <callseq>
        FileTest.exist? ( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file exists.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.exist?( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.exist?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="exists?" ref="exists_qm">
      <callseq>
        FileTest.exists? ( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Synonym for <mmm><file>filetest</file><front>FileTest</front><back>exist?</back><mref>exist_qm</mref></mmm>.
<p/>
      </desc>
    </method>
<p/>
        <method name="file?" ref="file_qm">
      <callseq>
        FileTest.file?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
     Returns <const>true</const> if the named file is a regular file (not a device 
     file, pipe, socket, etc.).
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.file?( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.file?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="grpowned?" ref="grpowned_qm">
      <callseq>
        FileTest.grpowned?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the effective group id of the process is the same 
      as the group id of the named file.
      On Windows NT, returns <const>false</const>.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.grpowned?( "/etc/passwd" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.grpowned?(<nbsp/>"/etc/passwd"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="owned?" ref="owned_qm">
      <callseq>
        FileTest.owned?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the effective user id of the process is the same 
      as the owner of the named file.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.owned?( "/etc/passwd" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.owned?(<nbsp/>"/etc/passwd"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="pipe?" ref="pipe_qm">
      <callseq>
        FileTest.pipe?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the operating system supports pipes and
      the named file is a pipe, <const>false</const> otherwise.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.pipe?( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.pipe?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="readable?" ref="readable_qm">
      <callseq>
        FileTest.readable?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is readable by the effective
      user id of this process.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.readable?( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.readable?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="readable_real?" ref="readable_real_qm">
      <callseq>
        FileTest.readable_real?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is readable by the real
      user id of this process.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.readable_real?( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.readable_real?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="setgid?" ref="setgid_qm">
      <callseq>
        FileTest.setgid?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file's set-group-id
      permission bit is set, and <const>false</const> if it isn't or
      if the operating system doesn't support this feature.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.setgid?( "/usr/sbin/lpc" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.setgid?(<nbsp/>"/usr/sbin/lpc"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="setuid?" ref="setuid_qm">
      <callseq>
        FileTest.setuid?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named  file's set-user-id
      permission bit is set, and <const>false</const> if it isn't or
      if the operating system doesn't support this feature.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.setuid?( "/bin/su" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.setuid?(<nbsp/>"/bin/su"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="size" ref="size">
      <callseq>
        FileTest.size( <obj>aString</obj> )
        <returns><obj>anInteger</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns the size of the named file in bytes.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.size( "testfile" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.size(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>66</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="size?" ref="size_qm">
      <callseq>
        FileTest.size?( <obj>aString</obj> )
        <returns><obj>aFixnum</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Returns <tt>nil</tt> if the named file is of zero length; otherwise,
      returns a nonzero <obj>aFixnum</obj>.
<p/>
<codefragment>
<fullcode><![CDATA[        FileTest.size?( "testfile" )
        FileTest.size?( "/dev/zero" )
]]></fullcode><rubycode>
<tr>
  <td><tt>FileTest.size?(<nbsp/>"testfile"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>66</tt></td>
</tr>
<tr>
  <td><tt>FileTest.size?(<nbsp/>"/dev/zero"<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="socket?" ref="socket_qm">
      <callseq>
        FileTest.socket?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is a socket, <const>false</const> if
      it isn't or 
      if the operating system doesn't support this feature.
<p/>
      </desc>
    </method>
<p/>
        <method name="sticky?" ref="sticky_qm">
      <callseq>
        FileTest.sticky?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file has its sticky bit set,
      <const>false</const> if it doesn't or if the operating system doesn't
      support this feature.
<p/>
      </desc>
    </method>
<p/>
        <method name="symlink?" ref="symlink_qm">
      <callseq>
        FileTest.symlink?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is a symbolic link,
      <const>false</const> if it isn't or if the operating system doesn't
      support this feature.
<p/>
      </desc>
    </method>
<p/>
        <method name="writable?" ref="writable_qm">
      <callseq>
        FileTest.writable?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is writable by the effective
      user id of this process.
<p/>
      </desc>
    </method>
<p/>
        <method name="writable_real?" ref="writable_real_qm">
      <callseq>
        FileTest.writable_real?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is writable by the real
      user id of this process.
<p/>
      </desc>
    </method>
<p/>
        <method name="zero?" ref="zero_qm">
      <callseq>
        FileTest.zero?( <obj>aString</obj> )
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the named file is of zero length, <const>false</const>
      otherwise.
<p/>
      </desc>
    </method>
<p/>
  </methods>
<p/>
</class>
</ppdoc>