Ruby Programming/Standard Library/Pathname

From Wikibooks, open books for an open world
< Ruby Programming
Jump to: navigation, search

Pathname[edit]

# Pathname represents a pathname which locates a file in a filesystem.
...
# It does not represent the file itself.
# A Pathname can be relative or absolute.  It's not until you try to
# reference the file that it even matters whether the file exists or not.

# The value of this class is to manipulate file path information in a neater
# way than standard Ruby provides.  The examples below demonstrate the
# difference.  *All* functionality from File, FileTest, and some from Dir and
# FileUtils is included, in an unsurprising way.  It is essentially a facade for
# all of these, and more.

To use it:

require 'pathname'