[DOC] Harmonize world_readable? methods

This commit is contained in:
Burdette Lamar authored and GitHub committed 2026-10-16 08:48:20 +09:00
1 parent f33766720c
commit 8c82ca2c3f
2 files changed
+14 -14
Notes: git 2026-10-15 23:48:53 +00:00

No files matched your search

+12 -11
View File
@@ -2421,9 +2421,9 @@ rb_file_readable_real_p(VALUE obj, VALUE fname)
* call-seq:
* File.world_readable?(object) -> integer or nil
*
* If the the given `object` exists and is readable by others,
* returns the integer [permissions](rdoc-ref:file/filesystem_modes.md@Permissions)
* for the entry;
* Returns the integer [permissions](rdoc-ref:file/filesystem_modes.md@Permissions)
* for the given `object`
* if it exists and is readable by others;
* otherwise, returns `nil`:
*
* ```ruby
@@ -7517,22 +7517,23 @@ rb_stat_R(VALUE obj)
* call-seq:
* world_readable? -> integer or nil
*
* If the entry in the [snapshot](rdoc-ref:File::Stat@Snapshot)
* in `self` exists and is readable by others,
* returns the integer [permissions](rdoc-ref:file/filesystem_modes.md@Permissions)
* for the entry;
* Returns the integer [permissions](rdoc-ref:file/filesystem_modes.md@Permissions)
* for the entry in the [snapshot](rdoc-ref:File::Stat@Snapshot) in `self`
* if those permissions allow reading by others;
* otherwise, returns `nil`:
*
* ```ruby
* filepath = '/tmp/t.tmp'
* File.write(filepath, 'foo') # Create file.
* File.chmod(0o000, filepath) # Make file unreadable.
* stat0 = File.stat(filepath) # Take snapshot.
* stat0.world_readable?.to_s(8) # => "664" # Snapshot shows world-readable.
* File.chmod(0o000, filepath) # Make unreadable.
* stat0.world_readable?.to_s(8) # => "664" # Snapshot not updated.
* stat0.world_readable? # => nil # Snapshot shows not world-readable.
* File.chmod(0o644, filepath) # Make file world-readable.
* stat0.world_readable? # => nil # Snapshot not updated.
* stat1 = File.stat(filepath) # Take new snapshot.
* stat1.world_readable? # => nil # Snapshot shows not world-readable.
* stat1.world_readable?.to_s(8) # => "644" # Snapshot shows world-readable.
* File.delete(filepath) # Clean up.
* stat1.world_readable?.to_s(8) # => "644" # Snapshot not updated.
* ```
*/
+2 -3
View File
@@ -2530,9 +2530,8 @@ class Pathname # * FileTest *
# call-seq:
# world_readable? -> integer or nil
#
# If the entry at the path in `self` exists and is readable by others,
# returns the integer [permissions](rdoc-ref:file/filesystem_modes.md@Permissions)
# for the entry;
# Returns the integer [permissions](rdoc-ref:file/filesystem_modes.md@Permissions)
# for the entry at the path in `self` if the entry exists and is readable by others;
# otherwise, returns `nil`:
#
# ```ruby