@@ -2946,26 +2946,28 @@ chmod_internal(const char *path, void *mode)
29462946
29472947/*
29482948 * call-seq:
2949- * File.chmod(mode, *paths) -> integer
2949+ * File.chmod(mode, *paths) -> integer
29502950 *
2951- * Changes the mode (i.e., permissions) of the entries of each the given +paths+;
2952- * see {File Permissions}[rdoc-ref:File@File+Permissions].
2953- * Returns the count of the given +paths+:
2951+ * Changes the modes of each of the entries at each the given +paths+;
2952+ * returns the count of the given +paths+.
2953+ * See {Filesystem Modes}[rdoc-ref:file/filesystem_modes.md]
2954+ * and especially {Setting a Mode}[rdoc-ref:file/filesystem_modes.md@Setting+a+Mode].
29542955 *
2955- * filepath = 't.tmp'
2956- * File.write(filepath, 'foo')
2957- * dirpath = 'tempdir'
2958- * Dir.mkdir(dirpath)
2959- * File::Stat.new(filepath).mode.to_s(8) # => "100664"
2960- * File::Stat.new(dirpath).mode.to_s(8) # => "40775"
2961- * File.chmod(0775, filepath, dirpath) # => 2
2962- * File::Stat.new(filepath).mode.to_s(8) # => "100775"
2963- * File::Stat.new(dirpath).mode.to_s(8) # => "40775"
2964- * File.chmod(0664, filepath, dirpath) # => 2
2965- * File::Stat.new(filepath).mode.to_s(8) # => "100664"
2966- * File::Stat.new(dirpath).mode.to_s(8) # => "40664"
2967- * File.delete(filepath)
2968- * Dir.rmdir(dirpath)
2956+ * These examples use
2957+ * a {helper method}[rdoc-ref:file/filesystem_modes.md@Helper+Method], +mode+,
2958+ * that displays a mode both in octal digits and in characters:
2959+ *
2960+ * dirpath = 'doc/foo'
2961+ * filepath = File.join(dirpath, 't.tmp')
2962+ * Dir.mkdir(dirpath) # Create directory.
2963+ * mode(dirpath) # => "040775 drwxrwxr-x"
2964+ * File.write(filepath, 'bar') # Create file.
2965+ * mode(filepath) # => "100664 -rw-rw-r--"
2966+ * File.chmod(0755, filepath) # Change file mode.
2967+ * mode(filepath) # => "100755 -rwxr-xr-x"
2968+ * File.chmod(0664, dirpath) # Change directory mode.
2969+ * mode(dirpath) # => "040664 drw-rw-r--"
2970+ * FileUtils.rm_rf(dirpath) # Clean up.
29692971 *
29702972 */
29712973
@@ -3005,15 +3007,25 @@ rb_fchmod(struct rb_io* io, mode_t mode)
30053007
30063008/*
30073009 * call-seq:
3008- * file.chmod(mode_int) -> 0
3010+ * chmod(mode) -> 0
3011+ *
3012+ * Changes the mode of +self+; returns '0'.
3013+ * See {Filesystem Modes}[rdoc-ref:file/filesystem_modes.md]
3014+ * and especially {Setting a Mode}[rdoc-ref:file/filesystem_modes.md@Setting+a+Mode].
30093015 *
3010- * Changes permission bits on <i>file</i> to the bit pattern
3011- * represented by <i>mode_int</i>. Actual effects are platform
3012- * dependent; on Unix systems, see <code>chmod(2)</code> for details.
3013- * Follows symbolic links. Also see File#lchmod.
3016+ * These examples use
3017+ * a {helper method}[rdoc-ref:file/filesystem_modes.md@Helper+Method], +mode+,
3018+ * that displays a mode both in octal digits and in characters:
3019+ *
3020+ * filepath = 'doc/t.tmp'
3021+ * File.write(filepath, 'foo')
3022+ * file = File.new(filepath)
3023+ * mode(filepath) # => "100664 -rw-rw-r--"
3024+ * file.chmod(0775)
3025+ * mode(filepath) # => "100775 -rwxrwxr-x"
3026+ * file.close
3027+ * File.delete(filepath)
30143028 *
3015- * f = File.new("out", "w");
3016- * f.chmod(0644) #=> 0
30173029 */
30183030
30193031static VALUE
0 commit comments