file.path â filename Instance Public methods Returns the pathname used to create file as a string. Does not normalize the name. File.new("testfile").path #=> "testfile" File.new("/tmp/../tmp/xxx", "w").path #=> "/tmp/../tmp/xxx"
file.truncate(integer) â 0 Instance Public methods Truncates file to at most integer bytes. The file must be opened for writing. Not available on all platforms. f = File.new("out", "w") f.syswrite("1234567890") #=> 10 f.truncate(5) #=> 0 f.close() #=> nil File.size("out") #=> 5
File.blockdev?(file_name) â true or false Instance Public methods Returns true if the named file is a block device. file_name can be an IO object.
File.chardev?(file_name) â true or false Instance Public methods Returns true if the named file is a character device. file_name can be an IO object.
File.directory?(file_name) â true or false Instance Public methods Returns true if the named file is a directory, or a symlink that points at a directory, and false otherwise. file_name can be an IO object. File.directory?(".")
File.executable?(file_name) â true or false Instance Public methods Returns true if the named file is executable by the effective user id of this process.
File.executable_real?(file_name) â true or false Instance Public methods Returns true if the named file is executable by the real user id of this process.
File.exist?(file_name) â true or false Instance Public methods Return true if the named file exists. file_name can be an IO object. âfile existsâ means that stat() or fstat() system call is successful.
File.exists?(file_name) â true or false Instance Public methods Return true if the named file exists. file_name can be an IO object. âfile existsâ means that stat() or fstat() system call is successful.
File.file?(file_name) â true or false Instance Public methods Returns true if the named file exists and is a regular file. file_name can be an IO object.
Page 246 of 11844