Just curious if there is an elegant ruby idiom for opening a file and
getting out with minimal fuss if the file can't be opened. Something
like perl's
open(blah blah) || die "cannot open file"
The obvious seems to be ruby's
begin
f = File.open(blah)
rescue
abort "cannot open file"
end
While that does give me a heck of a lot more fine-grained control over
responding to different error types and so on, it seems a little bulky
and verbose if all I really want is a quick message and a non-zero
exit status.
Am I missing an option or idiom?
Thanks!
-glenn
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby