rdx 0.9.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.rdx +20 -0
  3. data/README +19 -0
  4. data/bin/rdx +7 -0
  5. data/examples/minimal/.rdx +8 -0
  6. data/examples/minimal/README +10 -0
  7. data/examples/minimal/lib/other_conventions.rb +64 -0
  8. data/examples/minimal/lib/the_basics.rb +94 -0
  9. data/examples/minimal/lib/using_directives.rb +66 -0
  10. data/examples/minimal/rakefile +27 -0
  11. data/examples/ruby-2.0.0-p0/README +7 -0
  12. data/examples/ruby-2.0.0-p0/install/core/.rdx +6 -0
  13. data/examples/ruby-2.0.0-p0/install/core/README +19 -0
  14. data/examples/ruby-2.0.0-p0/install/core/Rakefile +61 -0
  15. data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +166 -0
  16. data/examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff +11 -0
  17. data/examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff +36 -0
  18. data/examples/ruby-2.0.0-p0/install/core/diffs/compar.c.diff +11 -0
  19. data/examples/ruby-2.0.0-p0/install/core/diffs/complex.c.diff +301 -0
  20. data/examples/ruby-2.0.0-p0/install/core/diffs/cont.c.diff +65 -0
  21. data/examples/ruby-2.0.0-p0/install/core/diffs/dir.c.diff +147 -0
  22. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/re.rdoc.diff +328 -0
  23. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/security.rdoc.diff +8 -0
  24. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/standard_library.rdoc.diff +0 -0
  25. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax.rdoc.diff +0 -0
  26. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/assignment.rdoc.diff +160 -0
  27. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/calling_methods.rdoc.diff +130 -0
  28. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/control_expressions.rdoc.diff +254 -0
  29. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/exceptions.rdoc.diff +0 -0
  30. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/literals.rdoc.diff +54 -0
  31. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/methods.rdoc.diff +157 -0
  32. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/miscellaneous.rdoc.diff +91 -0
  33. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/modules_and_classes.rdoc.diff +161 -0
  34. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/precedence.rdoc.diff +8 -0
  35. data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/refinements.rdoc.diff +146 -0
  36. data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +276 -0
  37. data/examples/ruby-2.0.0-p0/install/core/diffs/enum.c.diff +281 -0
  38. data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +479 -0
  39. data/examples/ruby-2.0.0-p0/install/core/diffs/error.c.diff +143 -0
  40. data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +47 -0
  41. data/examples/ruby-2.0.0-p0/install/core/diffs/eval_jump.c.diff +23 -0
  42. data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +752 -0
  43. data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +195 -0
  44. data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +84 -0
  45. data/examples/ruby-2.0.0-p0/install/core/diffs/iseq.c.diff +354 -0
  46. data/examples/ruby-2.0.0-p0/install/core/diffs/load.c.diff +53 -0
  47. data/examples/ruby-2.0.0-p0/install/core/diffs/marshal.c.diff +98 -0
  48. data/examples/ruby-2.0.0-p0/install/core/diffs/math.c.diff +110 -0
  49. data/examples/ruby-2.0.0-p0/install/core/diffs/numeric.c.diff +103 -0
  50. data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +295 -0
  51. data/examples/ruby-2.0.0-p0/install/core/diffs/pack.c.diff +18 -0
  52. data/examples/ruby-2.0.0-p0/install/core/diffs/parse.y.diff +23 -0
  53. data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +155 -0
  54. data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +126 -0
  55. data/examples/ruby-2.0.0-p0/install/core/diffs/range.c.diff +49 -0
  56. data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +312 -0
  57. data/examples/ruby-2.0.0-p0/install/core/diffs/re.c.diff +207 -0
  58. data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +21 -0
  59. data/examples/ruby-2.0.0-p0/install/core/diffs/signal.c.diff +67 -0
  60. data/examples/ruby-2.0.0-p0/install/core/diffs/sprintf.c.diff +29 -0
  61. data/examples/ruby-2.0.0-p0/install/core/diffs/string.c.diff +73 -0
  62. data/examples/ruby-2.0.0-p0/install/core/diffs/struct.c.diff +20 -0
  63. data/examples/ruby-2.0.0-p0/install/core/diffs/time.c.diff +691 -0
  64. data/examples/ruby-2.0.0-p0/install/core/diffs/transcode.c.diff +435 -0
  65. data/examples/ruby-2.0.0-p0/install/core/diffs/variable.c.diff +62 -0
  66. data/examples/ruby-2.0.0-p0/install/core/diffs/vm_backtrace.c.diff +164 -0
  67. data/examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff +99 -0
  68. data/examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff +17 -0
  69. data/examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff +393 -0
  70. data/examples/ruby-2.0.0-p0/install/stdlib/.rdx +6 -0
  71. data/examples/ruby-2.0.0-p0/install/stdlib/README +19 -0
  72. data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +53 -0
  73. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff +77 -0
  74. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff +42 -0
  75. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff +144 -0
  76. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/cmath.rb.diff +52 -0
  77. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/forwardable.rb.diff +150 -0
  78. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/mathn.rb.diff +58 -0
  79. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/matrix.rb.diff +657 -0
  80. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/observer.rb.diff +31 -0
  81. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +147 -0
  82. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/ostruct.rb.diff +78 -0
  83. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/prime.rb.diff +52 -0
  84. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/pstore.rb.diff +110 -0
  85. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/scanf.rb.diff +100 -0
  86. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/securerandom.rb.diff +144 -0
  87. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/set.rb.diff +637 -0
  88. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/shellwords.rb.diff +66 -0
  89. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/singleton.rb.diff +37 -0
  90. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tempfile.rb.diff +104 -0
  91. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/thread.rb.diff +38 -0
  92. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/time.rb.diff +140 -0
  93. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tmpdir.rb.diff +52 -0
  94. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff +39 -0
  95. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +237 -0
  96. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +36 -0
  97. data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff +27 -0
  98. data/examples/ruby-2.0.0-p0/rakefile +165 -0
  99. data/lib/rdx.rb +331 -0
  100. data/lib/rdx/assertions.rb +484 -0
  101. data/lib/rdx/binding.rb +151 -0
  102. data/lib/rdx/code_object.rb +598 -0
  103. data/lib/rdx/comment.rb +338 -0
  104. data/lib/rdx/convention.rb +1174 -0
  105. data/lib/rdx/directive.rb +1432 -0
  106. data/lib/rdx/example.rb +679 -0
  107. data/lib/rdx/generator.rb +112 -0
  108. data/lib/rdx/generator/rdoc.rb +1006 -0
  109. data/lib/rdx/options.rb +359 -0
  110. data/lib/rdx/plain_text.rb +65 -0
  111. data/lib/rdx/reporter.rb +421 -0
  112. data/lib/rdx/ruby_lex.rb +324 -0
  113. data/lib/rdx/runner.rb +309 -0
  114. data/lib/rdx/source_file.rb +94 -0
  115. data/lib/rdx/specification.rb +194 -0
  116. data/lib/rdx/statement.rb +248 -0
  117. data/lib/rdx/store.rb +119 -0
  118. data/lib/rdx/task.rb +361 -0
  119. data/lib/rdx/text.rb +688 -0
  120. data/lib/rdx/version.rb +15 -0
  121. data/rakefile +64 -0
  122. metadata +203 -0
@@ -0,0 +1,143 @@
1
+ --- core/orig/error.c 2015-06-11 07:51:44 +0000
2
+ +++ core/patched/error.c 2015-06-18 20:20:56 +0000
3
+ @@ -242,12 +242,13 @@
4
+ * warn(msg, ...) -> nil
5
+ *
6
+ * Displays each of the given messages followed by a record separator on
7
+ - * STDERR unless warnings have been disabled (for example with the
8
+ + * $stderr unless warnings have been disabled (for example with the
9
+ * <code>-W0</code> flag).
10
+ - *
11
+ + *
12
+ * warn("warning 1", "warning 2")
13
+ *
14
+ - * <em>produces:</em>
15
+ + * <em>produces on $stderr:</em>
16
+ + * :rdx: stderr
17
+ *
18
+ * warning 1
19
+ * warning 2
20
+ @@ -667,7 +668,8 @@
21
+ * Returns any backtrace associated with the exception. The backtrace
22
+ * is an array of strings, each containing either ``filename:lineNo: in
23
+ * `method''' or ``filename:lineNo.''
24
+ - *
25
+ + *
26
+ + * # File: prog.rb
27
+ * def a
28
+ * raise "boom"
29
+ * end
30
+ @@ -682,11 +684,11 @@
31
+ * print detail.backtrace.join("\n")
32
+ * end
33
+ *
34
+ - * <em>produces:</em>
35
+ - *
36
+ + * Then from the command line:
37
+ + * $ ruby prog.rb
38
+ * prog.rb:2:in `a'
39
+ * prog.rb:6:in `b'
40
+ - * prog.rb:10
41
+ + * prog.rb:10:in `<main>'
42
+ */
43
+
44
+ static VALUE
45
+ @@ -1171,7 +1173,11 @@
46
+ * The full list of operating system errors on your particular platform
47
+ * are available as the constants of <code>Errno</code>.
48
+ *
49
+ - * Errno.constants #=> :E2BIG, :EACCES, :EADDRINUSE, :EADDRNOTAVAIL, ...
50
+ + * Errno.constants # -> [
51
+ + * # :E2BIG, :EACCES, :EADDRINUSE,
52
+ + * # :EADDRNOTAVAIL,
53
+ + * # # ...
54
+ + * # ]
55
+ */
56
+
57
+ static st_table *syserr_tbl;
58
+ @@ -1332,7 +1338,7 @@
59
+ *
60
+ * <em>raises the exception:</em>
61
+ *
62
+ - * LoadError: no such file to load -- does/not/exist
63
+ + * LoadError: cannot load such file -- does/not/exist
64
+ *
65
+ */
66
+
67
+ @@ -1346,6 +1352,8 @@
68
+ * Document-class: SignalException
69
+ *
70
+ * Raised when a signal is received.
71
+ + *
72
+ + * :rdx: if Signal.list['HUP']
73
+ *
74
+ * begin
75
+ * Process.kill('HUP',Process.pid)
76
+ @@ -1364,10 +1372,16 @@
77
+ * Raised with the interrupt signal is received, typically because the
78
+ * user pressed on Control-C (on most posix platforms). As such, it is a
79
+ * subclass of +SignalException+.
80
+ - *
81
+ + *
82
+ * begin
83
+ * puts "Press ctrl-C when you get bored"
84
+ - * loop {}
85
+ + *-- rdx
86
+ + * raise Interrupt
87
+ + *++
88
+ + * loop do
89
+ + * # ... do something ...
90
+ + * end
91
+ + * # meanwhile the user pressed on Control-C
92
+ * rescue Interrupt => e
93
+ * puts "Note: You will typically use Signal.trap instead."
94
+ * end
95
+ @@ -1375,10 +1389,9 @@
96
+ * <em>produces:</em>
97
+ *
98
+ * Press ctrl-C when you get bored
99
+ - *
100
+ - * <em>then waits until it is interrupted with Control-C and then prints:</em>
101
+ - *
102
+ * Note: You will typically use Signal.trap instead.
103
+ + *
104
+ + *
105
+ */
106
+
107
+ /*
108
+ @@ -1425,7 +1438,7 @@
109
+ * a = [:foo, :bar]
110
+ * a.fetch(0) #=> :foo
111
+ * a[4] #=> nil
112
+ - * a.fetch(4) #=> IndexError: index 4 outside of array bounds: -2...2
113
+ + * a.fetch(4) # raises IndexError: index 4 outside of array bounds: -2...2
114
+ *
115
+ */
116
+
117
+ @@ -1437,7 +1450,7 @@
118
+ *
119
+ * h = {"foo" => :bar}
120
+ * h.fetch("foo") #=> :bar
121
+ - * h.fetch("baz") #=> KeyError: key not found: "baz"
122
+ + * h.fetch("baz") # raises KeyError: key not found: "baz"
123
+ *
124
+ */
125
+
126
+ @@ -1473,7 +1486,7 @@
127
+ *
128
+ * <em>raises the exception:</em>
129
+ *
130
+ - * SyntaxError: (eval):1: syntax error, unexpected '=', expecting $end
131
+ + * SyntaxError: (eval):1: syntax error, unexpected '=', expecting end-of-input
132
+ */
133
+
134
+ /*
135
+ @@ -1486,7 +1499,7 @@
136
+ *
137
+ * <em>raises the exception:</em>
138
+ *
139
+ - * LoadError: no such file to load -- this/file/does/not/exist
140
+ + * LoadError: cannot load such file -- this/file/does/not/exist
141
+ */
142
+
143
+ /*
@@ -0,0 +1,47 @@
1
+ --- core/orig/eval.c 2015-06-11 07:51:44 +0000
2
+ +++ core/patched/eval.c 2015-06-12 23:48:06 +0000
3
+ @@ -321,13 +321,13 @@
4
+ *
5
+ * Returns the list of +Modules+ nested at the point of call.
6
+ *
7
+ - * module M1
8
+ + * nesting = module M1
9
+ * module M2
10
+ - * $a = Module.nesting
11
+ + * Module.nesting # returned to nesting
12
+ * end
13
+ * end
14
+ - * $a #=> [M1::M2, M1]
15
+ - * $a[0].name #=> "M1::M2"
16
+ + * nesting[0] #=> M1::M2
17
+ + * nesting[1].name #=> "M1"
18
+ */
19
+
20
+ static VALUE
21
+ @@ -357,14 +357,12 @@
22
+ * This list includes the names of all modules and classes
23
+ * defined in the global scope.
24
+ *
25
+ - * Module.constants.first(4)
26
+ - * # => [:ARGF, :ARGV, :ArgumentError, :Array]
27
+ + * Module.constants.sort.first(4)
28
+ + * # -> [:ARGF, :ARGV, :ArgumentError, :Array]
29
+ *
30
+ * Module.constants.include?(:SEEK_SET) # => false
31
+ *
32
+ - * class IO
33
+ - * Module.constants.include?(:SEEK_SET) # => true
34
+ - * end
35
+ + * IO.constants.include?(:SEEK_SET) # => true
36
+ *
37
+ * The second form calls the instance method +constants+.
38
+ */
39
+ @@ -569,6 +567,8 @@
40
+ * array of callback information. Exceptions are caught by the
41
+ * +rescue+ clause of <code>begin...end</code> blocks.
42
+ *
43
+ + * :rdx: off
44
+ + * :rdx: # the expectation "raises" is obvious here...
45
+ * raise "Failed to create socket"
46
+ * raise ArgumentError, "No parameters", caller
47
+ */
@@ -0,0 +1,23 @@
1
+ --- core/orig/eval_jump.c 2015-06-11 07:51:43 +0000
2
+ +++ core/patched/eval_jump.c 2015-06-11 07:51:46 +0000
3
+ @@ -21,7 +21,8 @@
4
+ * binds it at the point of call) and registers it for execution when
5
+ * the program exits. If multiple handlers are registered, they are
6
+ * executed in reverse order of registration.
7
+ - *
8
+ + *
9
+ + * # File: prog.rb
10
+ * def do_at_exit(str1)
11
+ * at_exit { print str1 }
12
+ * end
13
+ @@ -29,8 +30,9 @@
14
+ * do_at_exit("goodbye ")
15
+ * exit
16
+ *
17
+ - * <em>produces:</em>
18
+ + * Then from the command line:
19
+ *
20
+ + * $ ruby prog.rb
21
+ * goodbye cruel world
22
+ */
23
+
@@ -0,0 +1,752 @@
1
+ --- core/orig/file.c 2015-06-11 07:51:44 +0000
2
+ +++ core/patched/file.c 2015-06-28 11:41:02 +0000
3
+ @@ -267,7 +267,10 @@
4
+ * not normalize the name.
5
+ *
6
+ * File.new("testfile").path #=> "testfile"
7
+ - * File.new("/tmp/../tmp/xxx", "w").path #=> "/tmp/../tmp/xxx"
8
+ + *-- rdx
9
+ + * Dir.mkdir 'tmp'
10
+ + *++
11
+ + * File.new("tmp/../tmp/xxx", "w").path #=> "tmp/../tmp/xxx"
12
+ *
13
+ */
14
+
15
+ @@ -329,6 +332,7 @@
16
+ * Compares <code>File::Stat</code> objects by comparing their
17
+ * respective modification times.
18
+ *
19
+ + * :rdx: is_slow
20
+ * f1 = File.new("f1", "w")
21
+ * sleep 1
22
+ * f2 = File.new("f2", "w")
23
+ @@ -371,7 +375,7 @@
24
+ * Returns an integer representing the device on which <i>stat</i>
25
+ * resides.
26
+ *
27
+ - * File.stat("testfile").dev #=> 774
28
+ + * File.stat("testfile").dev #-> 774
29
+ */
30
+
31
+ static VALUE
32
+ @@ -387,8 +391,10 @@
33
+ * Returns the major part of <code>File_Stat#dev</code> or
34
+ * <code>nil</code>.
35
+ *
36
+ - * File.stat("/dev/fd1").dev_major #=> 2
37
+ - * File.stat("/dev/tty").dev_major #=> 5
38
+ + * :rdx: if File.exist?("/dev/fd1")
39
+ + * File.stat("/dev/fd1").dev_major # -> 2
40
+ + * :rdx: if File.exist?("/dev/tty")
41
+ + * File.stat("/dev/tty").dev_major # -> 5
42
+ */
43
+
44
+ static VALUE
45
+ @@ -408,8 +414,10 @@
46
+ * Returns the minor part of <code>File_Stat#dev</code> or
47
+ * <code>nil</code>.
48
+ *
49
+ - * File.stat("/dev/fd1").dev_minor #=> 1
50
+ - * File.stat("/dev/tty").dev_minor #=> 0
51
+ + * :rdx: if File.exist?("/dev/fd1")
52
+ + * File.stat("/dev/fd1").dev_minor # -> 1
53
+ + * :rdx: if File.exist?("/dev/tty")
54
+ + * File.stat("/dev/tty").dev_minor # -> 0
55
+ */
56
+
57
+ static VALUE
58
+ @@ -428,7 +436,7 @@
59
+ *
60
+ * Returns the inode number for <i>stat</i>.
61
+ *
62
+ - * File.stat("testfile").ino #=> 1083669
63
+ + * File.stat("testfile").ino # -> 1083669
64
+ *
65
+ */
66
+
67
+ @@ -450,7 +458,7 @@
68
+ * <i>stat</i>. The meaning of the bits is platform dependent; on
69
+ * Unix systems, see <code>stat(2)</code>.
70
+ *
71
+ - * File.chmod(0644, "testfile") #=> 1
72
+ + * File.chmod(0644, "testfile")
73
+ * s = File.stat("testfile")
74
+ * sprintf("%o", s.mode) #=> "100644"
75
+ */
76
+ @@ -469,6 +477,7 @@
77
+ *
78
+ * File.stat("testfile").nlink #=> 1
79
+ * File.link("testfile", "testfile.bak") #=> 0
80
+ + * :rdx: bug on x64-mingw32 I obtained 1
81
+ * File.stat("testfile").nlink #=> 2
82
+ *
83
+ */
84
+ @@ -485,7 +494,7 @@
85
+ *
86
+ * Returns the numeric user id of the owner of <i>stat</i>.
87
+ *
88
+ - * File.stat("testfile").uid #=> 501
89
+ + * File.stat("testfile").uid #-> 501
90
+ *
91
+ */
92
+
93
+ @@ -501,7 +510,7 @@
94
+ *
95
+ * Returns the numeric group id of the owner of <i>stat</i>.
96
+ *
97
+ - * File.stat("testfile").gid #=> 500
98
+ + * File.stat("testfile").gid #-> 500
99
+ *
100
+ */
101
+
102
+ @@ -519,8 +528,10 @@
103
+ * <i>stat</i> resides. Returns <code>nil</code> if the operating
104
+ * system doesn't support this feature.
105
+ *
106
+ - * File.stat("/dev/fd1").rdev #=> 513
107
+ - * File.stat("/dev/tty").rdev #=> 1280
108
+ + * :rdx: if File.exist?("/dev/fd1")
109
+ + * File.stat("/dev/fd1").rdev # -> 513
110
+ + * :rdx: if File.exist?("/dev/tty")
111
+ + * File.stat("/dev/tty").rdev # -> 1280
112
+ */
113
+
114
+ static VALUE
115
+ @@ -540,8 +551,10 @@
116
+ * Returns the major part of <code>File_Stat#rdev</code> or
117
+ * <code>nil</code>.
118
+ *
119
+ - * File.stat("/dev/fd1").rdev_major #=> 2
120
+ - * File.stat("/dev/tty").rdev_major #=> 5
121
+ + * :rdx: if File.exist?("/dev/fd1")
122
+ + * File.stat("/dev/fd1").rdev_major # -> 2
123
+ + * :rdx: if File.exist?("/dev/tty")
124
+ + * File.stat("/dev/tty").rdev_major # -> 5
125
+ */
126
+
127
+ static VALUE
128
+ @@ -561,8 +574,10 @@
129
+ * Returns the minor part of <code>File_Stat#rdev</code> or
130
+ * <code>nil</code>.
131
+ *
132
+ - * File.stat("/dev/fd1").rdev_minor #=> 1
133
+ - * File.stat("/dev/tty").rdev_minor #=> 0
134
+ + * :rdx: if File.exist?("/dev/fd1")
135
+ + * File.stat("/dev/fd1").rdev_minor # -> 1
136
+ + * :rdx: if File.exist?("/dev/tty")
137
+ + * File.stat("/dev/tty").rdev_minor # -> 0
138
+ */
139
+
140
+ static VALUE
141
+ @@ -581,7 +596,7 @@
142
+ *
143
+ * Returns the size of <i>stat</i> in bytes.
144
+ *
145
+ - * File.stat("testfile").size #=> 66
146
+ + * File.stat("testfile").size #-> 66
147
+ */
148
+
149
+ static VALUE
150
+ @@ -597,7 +612,7 @@
151
+ * Returns the native file system's block size. Will return <code>nil</code>
152
+ * on platforms that don't support this information.
153
+ *
154
+ - * File.stat("testfile").blksize #=> 4096
155
+ + * File.stat("testfile").blksize # -> 4096
156
+ *
157
+ */
158
+
159
+ @@ -619,7 +634,7 @@
160
+ * file, or <code>nil</code> if the operating system doesn't
161
+ * support this feature.
162
+ *
163
+ - * File.stat("testfile").blocks #=> 2
164
+ + * File.stat("testfile").blocks # -> 2
165
+ */
166
+
167
+ static VALUE
168
+ @@ -715,7 +730,7 @@
169
+ * Returns the last access time for this file as an object of class
170
+ * <code>Time</code>.
171
+ *
172
+ - * File.stat("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969
173
+ + * File.stat("testfile").atime #-> Time.new(1969,12,31, 18,0,0)
174
+ *
175
+ */
176
+
177
+ @@ -731,7 +746,7 @@
178
+ *
179
+ * Returns the modification time of <i>stat</i>.
180
+ *
181
+ - * File.stat("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003
182
+ + * File.stat("testfile").mtime #-> Time.new(2003,4,9, 8,53,14)
183
+ *
184
+ */
185
+
186
+ @@ -751,7 +766,7 @@
187
+ *
188
+ * Note that on Windows (NTFS), returns creation time (birth time).
189
+ *
190
+ - * File.stat("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003
191
+ + * File.stat("testfile").ctime #-> Time.new(2003,4,9, 8,53,14)
192
+ *
193
+ */
194
+
195
+ @@ -767,8 +782,8 @@
196
+ *
197
+ * Produce a nicely formatted description of <i>stat</i>.
198
+ *
199
+ - * File.stat("/etc/passwd").inspect
200
+ - * #=> "#<File::Stat dev=0xe000005, ino=1078078, mode=0100644,
201
+ + * File.stat("testfile").inspect
202
+ + * #-> "#<File::Stat dev=0xe000005, ino=1078078, mode=0100644,
203
+ * # nlink=1, uid=0, gid=0, rdev=0x0, size=1374, blksize=4096,
204
+ * # blocks=8, atime=Wed Dec 10 10:16:12 CST 2003,
205
+ * # mtime=Fri Sep 12 15:41:41 CDT 2003,
206
+ @@ -901,7 +916,8 @@
207
+ * Returns a <code>File::Stat</code> object for the named file (see
208
+ * <code>File::Stat</code>).
209
+ *
210
+ - * File.stat("testfile").mtime #=> Tue Apr 08 12:58:04 CDT 2003
211
+ + * :rdx: no_warnings result_instance_of
212
+ + * File.stat("testfile") #=> #<File::Stat dev=0xe000005, ino=1078078 ... >
213
+ *
214
+ */
215
+
216
+ @@ -925,11 +941,12 @@
217
+ * Returns status information for <em>ios</em> as an object of type
218
+ * <code>File::Stat</code>.
219
+ *
220
+ + * :rdx: skip IO class needed
221
+ * f = File.new("testfile")
222
+ * s = f.stat
223
+ - * "%o" % s.mode #=> "100644"
224
+ - * s.blksize #=> 4096
225
+ - * s.atime #=> Wed Apr 09 08:53:54 CDT 2003
226
+ + * "%o" % s.mode #-> "100644"
227
+ + * s.blksize #-> 4096
228
+ + * s.atime # Wed Apr 09 08:53:54 CDT 2003
229
+ *
230
+ */
231
+
232
+ @@ -953,10 +970,14 @@
233
+ * Same as <code>File::stat</code>, but does not follow the last symbolic
234
+ * link. Instead, reports on the link itself.
235
+ *
236
+ - * File.symlink("testfile", "link2test") #=> 0
237
+ - * File.stat("testfile").size #=> 66
238
+ - * File.lstat("link2test").size #=> 8
239
+ - * File.stat("link2test").size #=> 66
240
+ + * :rdx: if File.respond_to?(:symlink)
241
+ + * File.symlink("testfile", "link2test")
242
+ + * File.stat("testfile").size #-> 66
243
+ + * File.lstat("link2test").size #-> 8
244
+ + * File.stat("link2test").size #-> 66
245
+ + *-- rdx
246
+ + * File.unlink("link2test")
247
+ + *++
248
+ *
249
+ */
250
+
251
+ @@ -985,11 +1006,12 @@
252
+ * Same as <code>IO#stat</code>, but does not follow the last symbolic
253
+ * link. Instead, reports on the link itself.
254
+ *
255
+ - * File.symlink("testfile", "link2test") #=> 0
256
+ - * File.stat("testfile").size #=> 66
257
+ + * :rdx: if File.respond_to?(:symlink)
258
+ + * File.symlink("testfile", "link2test")
259
+ + * File.stat("testfile").size #-> 66
260
+ * f = File.new("link2test")
261
+ - * f.lstat.size #=> 8
262
+ - * f.stat.size #=> 66
263
+ + * f.lstat.size #-> 8
264
+ + * f.stat.size #-> 66
265
+ */
266
+
267
+ static VALUE
268
+ @@ -1114,8 +1136,6 @@
269
+ */
270
+
271
+ /*
272
+ - * Document-method: directory?
273
+ - *
274
+ * call-seq:
275
+ * File.directory?(file_name) -> true or false
276
+ *
277
+ @@ -1123,7 +1143,7 @@
278
+ * or a symlink that points at a directory, and <code>false</code>
279
+ * otherwise.
280
+ *
281
+ - * File.directory?(".")
282
+ + * File.directory?(".") #=> true
283
+ */
284
+
285
+ VALUE
286
+ @@ -1354,9 +1374,10 @@
287
+ * <code>nil</code> otherwise. The meaning of the bits is platform
288
+ * dependent; on Unix systems, see <code>stat(2)</code>.
289
+ *
290
+ - * File.world_readable?("/etc/passwd") #=> 420
291
+ + * :rdx: if File.exist?("/etc/passwd")
292
+ + * File.world_readable?("/etc/passwd") # -> 420
293
+ * m = File.world_readable?("/etc/passwd")
294
+ - * sprintf("%o", m) #=> "644"
295
+ + * sprintf("%o", m) #-> "644"
296
+ */
297
+
298
+ static VALUE
299
+ @@ -1418,9 +1439,10 @@
300
+ * <code>nil</code> otherwise. The meaning of the bits is platform
301
+ * dependent; on Unix systems, see <code>stat(2)</code>.
302
+ *
303
+ - * File.world_writable?("/tmp") #=> 511
304
+ + * :rdx: if File.exist?("/tmp")
305
+ + * File.world_writable?("/tmp") # -> 511
306
+ * m = File.world_writable?("/tmp")
307
+ - * sprintf("%o", m) #=> "777"
308
+ + * sprintf("%o", m) #-> "777"
309
+ */
310
+
311
+ static VALUE
312
+ @@ -1654,14 +1676,16 @@
313
+ * Returns <code>true</code> if the named files are identical.
314
+ *
315
+ * open("a", "w") {}
316
+ - * p File.identical?("a", "a") #=> true
317
+ - * p File.identical?("a", "./a") #=> true
318
+ + * File.identical?("a", "a") #=> true
319
+ + * File.identical?("a", "./a") #=> true
320
+ * File.link("a", "b")
321
+ - * p File.identical?("a", "b") #=> true
322
+ + * File.identical?("a", "b") #=> true
323
+ + * :rdx: if File.respond_to?(:symlink)
324
+ * File.symlink("a", "c")
325
+ - * p File.identical?("a", "c") #=> true
326
+ + * File.identical?("a", "c") #=> true
327
+ + * :rdx:
328
+ * open("d", "w") {}
329
+ - * p File.identical?("a", "d") #=> false
330
+ + * File.identical?("a", "d") #=> false
331
+ */
332
+
333
+ static VALUE
334
+ @@ -1783,7 +1807,9 @@
335
+ * ``<code>socket</code>'', or ``<code>unknown</code>''.
336
+ *
337
+ * File.ftype("testfile") #=> "file"
338
+ + * :rdx: if File.exist? "/dev/tty"
339
+ * File.ftype("/dev/tty") #=> "characterSpecial"
340
+ + * :rdx: if File.exist? "/tmp/.X11-unix/X0"
341
+ * File.ftype("/tmp/.X11-unix/X0") #=> "socket"
342
+ */
343
+
344
+ @@ -1808,7 +1834,7 @@
345
+ *
346
+ * Returns the last access time for the named file as a Time object).
347
+ *
348
+ - * File.atime("testfile") #=> Wed Apr 09 08:51:48 CDT 2003
349
+ + * File.atime("testfile") #-> Time.new(1969,12,31, 18,0,0)
350
+ *
351
+ */
352
+
353
+ @@ -1829,9 +1855,9 @@
354
+ * file.atime -> time
355
+ *
356
+ * Returns the last access time (a <code>Time</code> object)
357
+ - * for <i>file</i>, or epoch if <i>file</i> has not been accessed.
358
+ + * for <i>file</i>, or epoch if <i>file</i> has not been accessed.
359
+ *
360
+ - * File.new("testfile").atime #=> Wed Dec 31 18:00:00 CST 1969
361
+ + * File.new("testfile").atime #-> Time.new(1969,12,31, 18,0,0)
362
+ *
363
+ */
364
+
365
+ @@ -1854,7 +1880,7 @@
366
+ *
367
+ * Returns the modification time for the named file as a Time object.
368
+ *
369
+ - * File.mtime("testfile") #=> Tue Apr 08 12:58:04 CDT 2003
370
+ + * File.mtime("testfile") #-> Time.new(2003,4,9, 8,53,14)
371
+ *
372
+ */
373
+
374
+ @@ -1876,7 +1902,7 @@
375
+ *
376
+ * Returns the modification time for <i>file</i>.
377
+ *
378
+ - * File.new("testfile").mtime #=> Wed Apr 09 08:53:14 CDT 2003
379
+ + * File.new("testfile").mtime #-> Time.new(2003,4,9, 8,53,14)
380
+ *
381
+ */
382
+
383
+ @@ -1903,7 +1929,7 @@
384
+ *
385
+ * Note that on Windows (NTFS), returns creation time (birth time).
386
+ *
387
+ - * File.ctime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003
388
+ + * File.ctime("testfile") #-> Time.new(2003,4,9, 8,53,14)
389
+ *
390
+ */
391
+
392
+ @@ -1928,7 +1954,7 @@
393
+ *
394
+ * Note that on Windows (NTFS), returns creation time (birth time).
395
+ *
396
+ - * File.new("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003
397
+ + * File.new("testfile").ctime #-> Time.new(2003,4,9, 8,53,14)
398
+ *
399
+ */
400
+
401
+ @@ -1951,7 +1977,7 @@
402
+ *
403
+ * Returns the size of <i>file</i> in bytes.
404
+ *
405
+ - * File.new("testfile").size #=> 66
406
+ + * File.new("testfile").size #-> 66
407
+ *
408
+ */
409
+
410
+ @@ -1988,6 +2014,9 @@
411
+ * <code>chmod(2)</code> for details. Returns the number of files
412
+ * processed.
413
+ *
414
+ + *-- rdx
415
+ + * File.write 'out', 'content'
416
+ + *++
417
+ * File.chmod(0644, "testfile", "out") #=> 2
418
+ */
419
+
420
+ @@ -2016,7 +2045,7 @@
421
+ * dependent; on Unix systems, see <code>chmod(2)</code> for details.
422
+ * Follows symbolic links. Also see <code>File#lchmod</code>.
423
+ *
424
+ - * f = File.new("out", "w");
425
+ + * f = File.new("testfile")
426
+ * f.chmod(0644) #=> 0
427
+ */
428
+
429
+ @@ -2106,7 +2135,7 @@
430
+ * belongs. A <code>nil</code> or -1 owner or group id is ignored.
431
+ * Returns the number of files processed.
432
+ *
433
+ - * File.chown(nil, 100, "testfile")
434
+ + * File.chown(nil, 100, "testfile") #=> 1
435
+ *
436
+ */
437
+
438
+ @@ -2147,7 +2176,7 @@
439
+ * <code>nil</code> or -1 owner or group id is ignored. Follows
440
+ * symbolic links. See also <code>File#lchown</code>.
441
+ *
442
+ - * File.new("testfile").chown(502, 1000)
443
+ + * File.new("testfile").chown(502, 1000) #=> 0
444
+ *
445
+ */
446
+
447
+ @@ -2390,8 +2419,11 @@
448
+ * overwrite <i>new_name</i> if it already exists (raising a subclass
449
+ * of <code>SystemCallError</code>). Not available on all platforms.
450
+ *
451
+ + * :rdx: if File.respond_to? :link
452
+ * File.link("testfile", ".testfile") #=> 0
453
+ - * IO.readlines(".testfile")[0] #=> "This is line one\n"
454
+ + * first_line = IO.readlines("testfile")[0]
455
+ + * first_line_link = IO.readlines(".testfile")[0]
456
+ + * first_line == first_line_link #=> true
457
+ */
458
+
459
+ static VALUE
460
+ @@ -2421,6 +2453,7 @@
461
+ * <i>old_name</i>. Raises a <code>NotImplemented</code> exception on
462
+ * platforms that do not support symbolic links.
463
+ *
464
+ + * :rdx: if File.respond_to? :symlink
465
+ * File.symlink("testfile", "link2test") #=> 0
466
+ *
467
+ */
468
+ @@ -2453,6 +2486,7 @@
469
+ * Returns the name of the file referenced by the given link.
470
+ * Not available on all platforms.
471
+ *
472
+ + * :rdx: if File.respond_to? :readlink
473
+ * File.symlink("testfile", "link2test") #=> 0
474
+ * File.readlink("link2test") #=> "testfile"
475
+ */
476
+ @@ -2528,7 +2562,13 @@
477
+ * Renames the given file to the new name. Raises a
478
+ * <code>SystemCallError</code> if the file cannot be renamed.
479
+ *
480
+ + *-- rdx
481
+ + * File.write 'afile', 'content'
482
+ + *++
483
+ * File.rename("afile", "afile.bak") #=> 0
484
+ + *-- rdx
485
+ + * File.delete "afile.bak"
486
+ + *++
487
+ */
488
+
489
+ static VALUE
490
+ @@ -2577,7 +2617,8 @@
491
+ * default permissions, so a umask of <code>0222</code> would make a
492
+ * file read-only for everyone.
493
+ *
494
+ - * File.umask(0006) #=> 18
495
+ + * :rdx: off
496
+ + * File.umask(0006) #-> 18
497
+ * File.umask #=> 6
498
+ */
499
+
500
+ @@ -3286,8 +3327,18 @@
501
+ * correctly). ``<code>~</code><i>user</i>'' expands to the named
502
+ * user's home directory.
503
+ *
504
+ - * File.expand_path("~oracle/bin") #=> "/home/oracle/bin"
505
+ - * File.expand_path("../../bin", "/tmp/x") #=> "/bin"
506
+ + *-- rdx
507
+ + * orig_home = ENV['HOME']
508
+ + * ENV['HOME'] = Dir.pwd
509
+ + *++
510
+ + * File.expand_path("~/oracle/bin") #=> "#{ENV['HOME']}/oracle/bin"
511
+ + *-- rdx
512
+ + * ENV['HOME'] = orig_home
513
+ + *++
514
+ + * File.expand_path("../../bin", "tmp/x") #=> "#{Dir.pwd}/bin"
515
+ + * File.expand_path("../../bin", "/tmp/x") #=> File.expand_path 'bin', '/'
516
+ + * # which is '/bin' on unix systems, something like 'C:\bin' on windows
517
+ + *
518
+ */
519
+
520
+ VALUE
521
+ @@ -3320,7 +3371,7 @@
522
+ * starting point. If the given pathname starts with a ``<code>~</code>''
523
+ * it is NOT expanded, it is treated as a normal directory name.
524
+ *
525
+ - * File.absolute_path("~oracle/bin") #=> "<relative_path>/~oracle/bin"
526
+ + * File.absolute_path("~oracle/bin") #=> "#{Dir.pwd}/~oracle/bin"
527
+ */
528
+
529
+ VALUE
530
+ @@ -3861,7 +3912,7 @@
531
+ *
532
+ * File.extname("test.rb") #=> ".rb"
533
+ * File.extname("a/b/d/test.rb") #=> ".rb"
534
+ - * File.extname("foo.") #=> ""
535
+ + * File.extname("foo.") #=> ""
536
+ * File.extname("test") #=> ""
537
+ * File.extname(".profile") #=> ""
538
+ * File.extname(".profile.sh") #=> ".sh"
539
+ @@ -3893,6 +3944,7 @@
540
+ * Returns the string representation of the path
541
+ *
542
+ * File.path("/dev/null") #=> "/dev/null"
543
+ + * require 'pathname'
544
+ * File.path(Pathname.new("/tmp")) #=> "/tmp"
545
+ *
546
+ */
547
+ @@ -4034,6 +4086,7 @@
548
+ * Truncates the file <i>file_name</i> to be at most <i>integer</i>
549
+ * bytes long. Not available on all platforms.
550
+ *
551
+ + * :rdx: if File.respond_to? :truncate
552
+ * f = File.new("out", "w")
553
+ * f.write("1234567890") #=> 10
554
+ * f.close #=> nil
555
+ @@ -4083,6 +4136,7 @@
556
+ * Truncates <i>file</i> to at most <i>integer</i> bytes. The file
557
+ * must be opened for writing. Not available on all platforms.
558
+ *
559
+ + * :rdx: if File.respond_to? :truncate
560
+ * f = File.new("out", "w")
561
+ * f.syswrite("1234567890") #=> 10
562
+ * f.truncate(5) #=> 0
563
+ @@ -4162,6 +4216,7 @@
564
+ * available on all platforms.
565
+ *
566
+ * Locking constants (in class File):
567
+ + * :rdx: off -
568
+ *
569
+ * LOCK_EX | Exclusive lock. Only one process may hold an
570
+ * | exclusive lock for a given file at a time.
571
+ @@ -4175,8 +4230,15 @@
572
+ * LOCK_UN | Unlock.
573
+ *
574
+ * Example:
575
+ + *
576
+ + * :rdx: if File.respond_to?(:flock)
577
+ + * :rdx: in_tmpdir
578
+ *
579
+ * # update a counter using write lock
580
+ + *
581
+ + * # initial state:
582
+ + * File.write "counter", "12\n"
583
+ + *
584
+ * # don't use "w" because it truncates the file before lock.
585
+ * File.open("counter", File::RDWR|File::CREAT, 0644) {|f|
586
+ * f.flock(File::LOCK_EX)
587
+ @@ -4190,8 +4252,8 @@
588
+ * # read the counter using read lock
589
+ * File.open("counter", "r") {|f|
590
+ * f.flock(File::LOCK_SH)
591
+ - * p f.read
592
+ - * }
593
+ + * f.read.to_i
594
+ + * } #=> 13
595
+ *
596
+ */
597
+
598
+ @@ -4265,6 +4327,8 @@
599
+ *
600
+ * File tests on a single file:
601
+ *
602
+ + * :rdx: off
603
+ + *
604
+ * Test Returns Meaning
605
+ * "A" | Time | Last access time for file1
606
+ * "b" | boolean | True if file1 is a block device
607
+ @@ -4465,6 +4529,15 @@
608
+ * <code>File#lstat</code>, and <code>File::lstat</code>. Many of these
609
+ * methods return platform-specific values, and not all values are
610
+ * meaningful on all systems. See also <code>Kernel#test</code>.
611
+ + *
612
+ + * In the following examples we assume that we are located in a temporary
613
+ + * directory where already exists a regular file named <code>"testfile"</code>.
614
+ + *
615
+ + *-- rdx
616
+ + * :rdx: in_tmpdir!!
617
+ + * :rdx: setup
618
+ + * File.write 'testfile', 'c'*66
619
+ + *++
620
+ */
621
+
622
+ static VALUE
623
+ @@ -4534,6 +4607,7 @@
624
+ * ``<code>fifo</code>'', ``<code>link</code>'',
625
+ * ``<code>socket</code>'', or ``<code>unknown</code>''.
626
+ *
627
+ + * :rdx: if File.exist?("/dev/tty")
628
+ * File.stat("/dev/tty").ftype #=> "characterSpecial"
629
+ *
630
+ */
631
+ @@ -4591,7 +4665,8 @@
632
+ * <code>false</code> for an object returned by
633
+ * <code>File::stat</code>.
634
+ *
635
+ - * File.symlink("testfile", "alink") #=> 0
636
+ + * :rdx: if File.respond_to? :symlink
637
+ + * File.symlink("testfile", "alink")
638
+ * File.stat("alink").symlink? #=> false
639
+ * File.lstat("alink").symlink? #=> true
640
+ *
641
+ @@ -4637,7 +4712,8 @@
642
+ * support this feature.
643
+ *
644
+ * File.stat("testfile").blockdev? #=> false
645
+ - * File.stat("/dev/hda1").blockdev? #=> true
646
+ + * :rdx: if File.exist?("/dev/hda1")
647
+ + * File.stat("/dev/hda1").blockdev? #-> true
648
+ *
649
+ */
650
+
651
+ @@ -4659,7 +4735,8 @@
652
+ * <code>false</code> if it isn't or if the operating system doesn't
653
+ * support this feature.
654
+ *
655
+ - * File.stat("/dev/tty").chardev? #=> true
656
+ + * :rdx: if File.exist?("/dev/tty")
657
+ + * File.stat("/dev/tty").chardev? #-> true
658
+ *
659
+ */
660
+
661
+ @@ -4679,7 +4756,8 @@
662
+ * the same as the owner of <i>stat</i>.
663
+ *
664
+ * File.stat("testfile").owned? #=> true
665
+ - * File.stat("/etc/passwd").owned? #=> false
666
+ + * :rdx: if File.exist?("/etc/passwd")
667
+ + * File.stat("/etc/passwd").owned? #-> false
668
+ *
669
+ */
670
+
671
+ @@ -4704,8 +4782,9 @@
672
+ * Returns true if the effective group id of the process is the same as
673
+ * the group id of <i>stat</i>. On Windows NT, returns <code>false</code>.
674
+ *
675
+ - * File.stat("testfile").grpowned? #=> true
676
+ - * File.stat("/etc/passwd").grpowned? #=> false
677
+ + * File.stat("testfile").grpowned? #-> true
678
+ + * :rdx: if File.exist?("/etc/passwd")
679
+ + * File.stat("/etc/passwd").grpowned? #-> false
680
+ *
681
+ */
682
+
683
+ @@ -4793,8 +4872,9 @@
684
+ * <code>nil</code> otherwise. The meaning of the bits is platform
685
+ * dependent; on Unix systems, see <code>stat(2)</code>.
686
+ *
687
+ - * m = File.stat("/etc/passwd").world_readable? #=> 420
688
+ - * sprintf("%o", m) #=> "644"
689
+ + * :rdx: off
690
+ + * m = File.stat("/etc/passwd").world_readable? #-> 420
691
+ + * sprintf("%o", m) #-> "644"
692
+ */
693
+
694
+ static VALUE
695
+ @@ -4885,8 +4965,9 @@
696
+ * <code>nil</code> otherwise. The meaning of the bits is platform
697
+ * dependent; on Unix systems, see <code>stat(2)</code>.
698
+ *
699
+ - * m = File.stat("/tmp").world_writable? #=> 511
700
+ - * sprintf("%o", m) #=> "777"
701
+ + * :rdx: if File.directory?("/tmp")
702
+ + * m = File.stat("/tmp").world_writable? #-> 511
703
+ + * sprintf("%o", m) #-> "777"
704
+ */
705
+
706
+ static VALUE
707
+ @@ -5013,7 +5094,7 @@
708
+ *
709
+ * Returns the size of <i>stat</i> in bytes.
710
+ *
711
+ - * File.stat("testfile").size #=> 66
712
+ + * File.stat("testfile").size #-> 66
713
+ *
714
+ */
715
+
716
+ @@ -5034,6 +5115,7 @@
717
+ * permission bit set, <code>false</code> if it doesn't or if the
718
+ * operating system doesn't support this feature.
719
+ *
720
+ + * :rdx: if File.file?("/bin/su")
721
+ * File.stat("/bin/su").setuid? #=> true
722
+ */
723
+
724
+ @@ -5054,7 +5136,8 @@
725
+ * permission bit set, <code>false</code> if it doesn't or if the
726
+ * operating system doesn't support this feature.
727
+ *
728
+ - * File.stat("/usr/sbin/lpc").setgid? #=> true
729
+ + * :rdx: if File.exist?("/usr/sbin/lpc")
730
+ + * File.stat("/usr/sbin/lpc").setgid? #-> true
731
+ *
732
+ */
733
+
734
+ @@ -5432,8 +5515,17 @@
735
+ * <code>0644</code>, which means read/write for owner, read-only for
736
+ * all others. The only change that can be made is to make the file
737
+ * read-only, which is reported as <code>0444</code>.
738
+ + *
739
+ + * In the following examples we assume that we are located in a temporary
740
+ + * directory where already exists a regular file named <code>"testfile"</code>.
741
+ + *
742
+ + *-- rdx
743
+ + * :rdx: in_tmpdir!!
744
+ + * :rdx: setup
745
+ + * File.write 'testfile', 'c'*66
746
+ + *++
747
+ + *
748
+ */
749
+ -
750
+ void
751
+ Init_File(void)
752
+ {