i find these come in real handy, and thought they would be good for
inclusion into FileUtils or barring that, then maybe the guys at Facets
lib might be interested. they are based on Unix shell test options, i.e.
[ -d somedir ] etc.
it would be fairly trivial to implement the other test options as well.
module FileUtils
def b? path
File.blockdev? path
end
def c? path
File.chardev? path
end
def d? path
File.directory? path
end
def e? path
File.exists? path
end
def f? path
File.file? path
end
def x?
File.executable? path
end
end
--
Posted via http://www.ruby-forum.com/.