--Boundary-00 Sd2EyMm63MlBlr Content-Type: Multipart/Mixed; boundaryoundary-00 Sd2EyMm63MlBlr" --Boundary-00 Sd2EyMm63MlBlr Content-Type: text/plain; charset tf-8" Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi folks, today I found myself wanting to get the parent directory name of a file, so I was looking whether Pathname has an to_a so I could do: parent_dir ath.to_a[-2] Since it didn't exist, I've written a small patch against CVS to add this simple function, maybe you find it useful :-) C'ya, Marc -- Marc Haisenko Comdasys AG Rüdesheimer Strae 7 D-80686 München Tel: +49 (0)89 - 548 43 33 21 Fax: +49 (0)89 - 548 43 33 29 e-mail: haisenko / comdasys.com http://www.comdasys.com --Boundary-00 Sd2EyMm63MlBlr Content-Type: text/x-diff; charset tf-8"; name athname-to_a.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename athname-to_a.patch" --- pathname.rb.orig 2006-07-08 10:56:27.000000000 +0200 +++ pathname.rb 2006-08-09 14:10:54.000000000 +0200 @@ -242,6 +242,13 @@ @path.dup end + # Return the path as an Array. + def to_a + a path.split SEPARATOR_PAT + a.shift if a[0].size 0 + a + end + # to_path is implemented so Pathname objects are usable with File.open, etc. alias_method TO_PATH, :to_s --Boundary-00 Sd2EyMm63MlBlr-- --Boundary-00 Sd2EyMm63MlBlr--