Ruby Pathname Functions

EditRocket provides the following information on Pathname functions in the Ruby source code builder.

absolute?() - Predicate method for testing whether a path is absolute. It returns true if the pathname begins with a slash.

ascend() - Iterates over and yields a new Pathname object for each element in the given path in ascending order.

atime() - See File.atime. Returns last access time.

basename(*args) - See File.basename. Returns the last component of the path.

blockdev?() - See FileTest.blockdev?.

chardev?() - See FileTest.chardev?.

chdir(&block) - Pathname#chdir is obsoleted at 1.8.1.

children(with_directory=true) - Returns the children of the directory (files and subdirectories, not recursive) as an array of Pathname objects. By default, the returned pathnames will have enough information to access the files. If you set with_directory to false, then the returned pathnames will contain the filename only.

chmod(mode) - See File.chmod. Changes permissions.

chown(owner, group) - See File.chown. Change owner and group of file.

chroot() - Pathname#chroot is obsoleted at 1.8.1.

cleanpath(consider_symlink=false) - Returns clean pathname of self with consecutive slashes and useless dots removed. The filesystem is not accessed.

ctime() - See File.ctime. Returns last (directory entry, not file) change time.

delete() - "Alias for #unlink"

descend() - Iterates over and yields a new Pathname object for each element in the given path in descending order.

dir_foreach(*args, &block) - Pathname#dir_foreach is obsoleted at 1.8.1.

directory?() - See

dirname() - See File.dirname. Returns all but the last component of the path.

each_entry() - Iterates over the entries (files and subdirectories) in the directory. It yields a Pathname object for each entry.

each_filename( {|filename| ...} - Iterates over each component of the path.

each_line(*args) - "#each_line iterates over the line in the file. It yields a String object for each line."

entries() - Return the entries (files and subdirectories) in the directory, each as a Pathname object.

eql?(other) - "Alias for #=="

executable?() - See FileTest.executable?.

executable_real?() - See FileTest.executable_real?.

exist?() - See FileTest.exist?.

expand_path(*args) - See File.expand_path.

extname() - See File.extname. Returns the file's extension.

file?() - See FileTest.file?.

find() - Pathname#find is an iterator to traverse a directory tree in a depth first manner. It yields a Pathname for each file under "this" directory.

fnmatch?(pattern, *args) - "See File.fnmatch? (same as #fnmatch)."

fnmatch(pattern, *args) - See File.fnmatch. Return true if the receiver matches the given pattern.

foreach(*args, &block) - "This method is obsoleted at 1.8.1. Use #each_line or #each_entry."

foreachline(*args, &block) - "Pathname#foreachline is obsoleted at 1.8.1. Use #each_line."

freeze() -

ftype() - See File.ftype. Returns "type" of file ("file", "directory", etc).

getwd() - See Dir.getwd. Returns the current working directory as a Pathname.

glob(*args) - See Dir.glob. Returns or yields Pathname objects.

grpowned?() - See FileTest.grpowned?.

join(*args) - Pathname#join joins pathnames.

lchmod(mode) - See File.lchmod.

lchown(owner, group) - See File.lchown.

link(old) - Pathname#link is confusing and obsoleted because the receiver/argument order is inverted to corresponding system call.

lstat() - See File.lstat.

make_link(old) - See Creates a hard link.

make_symlink(old) - See File.symlink. Creates a symbolic link.

mkdir(*args) - See Dir.mkdir. Create the referenced directory.

mkpath() - See FileUtils.mkpath. Creates a full path, including any intermediate directories that don't yet exist.

mountpoint?() - "#mountpoint? returns true if self points to a mountpoint."

mtime() - See File.mtime. Returns last modification time.

new(path) - Create a Pathname object from the given String (or String-like object). If path contains a NUL character (\0), an ArgumentError is raised.

open(*args) - See Opens the file for reading or writing.

opendir() - See

owned?() - See FileTest.owned?.

parent() - "#parent returns the parent directory."

pipe?() - See FileTest.pipe?.

read(*args) - See Returns all the bytes from the file, or the first N if specified.

readable?() - See FileTest.readable?.

readable_real?() - See FileTest.readable_real?.

readlines(*args) - See IO.readlines. Returns all the lines from the file.

readlink() - See File.readlink. Read symbolic link.

realpath() - Returns a real (absolute) pathname of self in the actual filesystem. The real pathname doesn't contain symlinks or useless dots.

relative?() - "The opposite of #absolute?"

relative_path_from(base_directory) - "#relative_path_from returns a relative path from the argument to the receiver. If self is absolute, the argument must be absolute too. If self is relative, the argument must be relative too."

rename(to) - See File.rename. Rename the file.

rmdir() - See Dir.rmdir. Remove the referenced directory.

rmtree() - See FileUtils.rm_r. Deletes a directory and all beneath it.

root?() - "#root? is a predicate for root directories. I.e. it returns true if the pathname consists of consecutive slashes."

setgid?() - See FileTest.setgid?.

setuid?() - See FileTest.setuid?.

size?() - See FileTest.size?.

size() - See FileTest.size.

socket?() - See FileTest.socket?.

split() - "See File.split. Returns the #dirname and the #basename in an Array."

stat() - See File.stat. Returns a File::Stat object.

sticky?() - See FileTest.sticky?.

sub(pattern, *rest, &block) - Return a pathname which is substituted by String#sub.

symlink?() - See FileTest.symlink?.

symlink(old) - Pathname#symlink is confusing and obsoleted because the receiver/argument order is inverted to corresponding system call.

sysopen(*args) - See IO.sysopen.

taint() -

TO_PATH() - "Alias for #to_s"

to_s() - Return the path as a String.

truncate(length) - See File.truncate. Truncate the file to length bytes.

unlink() - Removes a file or directory, using File.unlink or Dir.unlink as necessary.

untaint() -

utime(atime, mtime) - See File.utime. Update the access and modification times.

world_readable?() - See FileTest.world_readable?.

world_writable?() - See FileTest.world_writable?.

writable?() - See FileTest.writable?.

writable_real?() - See FileTest.writable_real?.

zero?() - See