Path: | lib/pathname2.rb |
Last Update: | Wed Feb 09 11:15:05 +0000 2011 |
Pathname represents a path name on a filesystem. A Pathname can be relative or absolute. It does not matter whether the path exists or not.
All functionality from File, FileTest, and Dir is included, using a facade pattern.
This class works on both Unix and Windows, including UNC path names. Note that forward slashes are converted to backslashes on Windows systems.
require "pathname2"
# Unix path1 = Pathname.new("/foo/bar/baz") path2 = Pathname.new("../zap")
path1 + path2 # "/foo/bar/zap" path1.dirname # "/foo/bar"
# Windows path1 = Pathname.new("C:\foo\bar\baz") path2 = Pathname.new("..\zap")
path1 + path2 # "C:\foo\bar\zap" path1.exists? # Does the path exist?
Daniel J. Berger djberg96 at gmail dot com imperator on IRC (irc.freenode.net)
Copyright (c) 2005-2008 Daniel J. Berger. Licensed under the same terms as Ruby itself.