From: Mike Gold Date: 2008-09-23T03:07:23+09:00 Subject: Re: File path operations? I went for years without knowing about Pathname. It seems rather underused. The singleton methods File.basename, File.exist?, etc. are awkward because the proper abstraction is a path, not an arbitrary string. Moreover, these methods cut against the natural flow of ruby code. Compare File.join File.dirname(foo), "intermediate", File.basename(foo) with foo.dirname.join "intermediate", foo.basename I would like to see more ruby packages use Pathname. If your method takes a string argument, then use it as a string. However if your method takes a path name disguised as a string, consider taking a Pathname. (In practice I expect you'd convert any non-Pathnames to Pathnames.) Now that Pathname has been in the standard library since 1.8.0, perhaps it is time for the whole standard library to use it? It certainly makes code cleaner and clearer. It also discourages the use of problematic "#{x}/#{y}" constructs. If x is nil, you are now pointing at the root directory, with not a peep of warning from ruby. -- Posted via http://www.ruby-forum.com/.