From: Joel VanderWerf Date: 2009-06-03T06:36:24+09:00 Subject: [ruby-core:23678] Re: feature request: Directory.dir? Roger Pack wrote: >>> For some reason it seems odd to have to do File.dir? >>> however, having that and Directory.dir? would be quite nice and make sense. >> Dir.exist? > > Hmm. Somehow Dir.exist? doesn't seem quite as...how to describe > it...fitting as Dir.dir? > -=r Aw, heck, why not def Dir?(f); File.directory?(f); end Dir?("/tmp") # => true and while we're at it: require 'fileutils' def Dir!(f); FileUtils.makedirs(f); end Dir?('/tmp/foo/bar') # => false Dir!('/tmp/foo/bar') # => "/tmp/foo/bar" Dir?('/tmp/foo/bar') # => true -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407