Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Pathname#world_writable?
() -> (::Integer | nil)
world_writable? → integer or nil
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2732
def world_writable?() File.world_writable?(@path) end
If the entry at the path in self exists and is writable by others, returns the integer permissions for the entry; otherwise, returns nil:
Example
pn = Pathname('/tmp/t.tmp') pn.world_writable? # => nil # Non-existent. pn.write('foo') # Create file. pn.world_writable? # => nil # Not world-writable. pn.chmod(0o777) # Make world-writable. pn.world_writable?.to_s(8) # => "511" # World-writable. pn.delete # Clean up. Pathname('/tmp').world_writable?.to_s(8) # => "777" # Directory.
See also
#world_readable?
#writable?
#utime
#writable_real?
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0