File permissions. Use File.chmod to set permissions (system dependent). : world_readable « File Directory « Ruby






File permissions. Use File.chmod to set permissions (system dependent).


f = "/usr/bin/ruby"      # A filename for the examples below

File.readable?(f)        # Can we read the file?
File.writable?(f)        # Can we write the file? No "e" in "writable"
File.executable?(f)      # Can we execute the file?
File.world_readable?(f)  # Can everybody read it? Ruby 1.9.
File.world_writable?(f)  # Can everybody write it? Ruby 1.9.

 








Related examples in the same category