Sha256: 88444810c67c80d1e94b4232690228cefde031f66bc2eedf999325f98704270d

Contents?: true

Size: 720 Bytes

Versions: 15

Compression:

Stored size: 720 Bytes

Contents

########################################################################
# example_pathname.rb
#
# Some examples to demonstrate the behavior of the pathname2 library.
########################################################################
require 'pathname2'

puts "VERSION: " + Pathname::VERSION

path1 = Pathname.new("foo/bar")
path2 = Pathname.new("baz/blah")

path3 = Pathname.new("foo/../bar")
path4 = Pathname.new("../baz")

p path1 + path2 # foo/bar/baz/blah
p path3 + path4 # baz

# Shortcut syntax
path = pn{ "C:\\Documents and Settings\\snoopy\\My Documents" }

p path[0]    # C:
p path[1]    # Documents and Settings
p path[0,2]  # C:\\Documents and Settings
p path[0..2] # C:\\Documents and Settings\\snoopy

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pathname2-1.8.4 examples/example_pathname.rb
pathname2-1.8.3 examples/example_pathname.rb
pathname2-1.8.2 examples/example_pathname.rb
pathname2-1.8.1 examples/example_pathname.rb
pathname2-1.8.0 examples/example_pathname.rb
pathname2-1.7.4 examples/example_pathname.rb
pathname2-1.7.3 examples/example_pathname.rb
pathname2-1.7.2 examples/example_pathname.rb
pathname2-1.7.1 examples/example_pathname.rb
pathname2-1.7.0 examples/example_pathname.rb
pathname2-1.6.5 examples/example_pathname.rb
pathname2-1.6.4-x86-mingw32 examples/example_pathname.rb
pathname2-1.6.4 examples/example_pathname.rb
pathname2-1.6.3 examples/example_pathname.rb
pathname2-1.6.2 examples/example_pathname.rb