--000e0cd217a4c3289a046d85734e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Mon, Jun 29, 2009 at 4:07 PM, David A. Black <dblack / rubypal.com> wrote: > On Tue, 30 Jun 2009, David A. Black wrote: > > Hi -- >> >> On Tue, 30 Jun 2009, Diana Jaunzeikare wrote: >> >> Thanks a lot! It worked like a charm! >>> >> >> Rob Biedenharn, in another context, reminded me that >> exception-handling blocks can have an "else" clause. So you could do >> the slightly simpler: >> >> begin >> require "xml" >> rescue LoadError >> puts "No xml library..." >> else >> class TestPhyloXML1 < Test::Unit::TestCase >> ... >> end >> end >> > > OK, third time a charm. > > begin > require 'xml' > class TestPhyloXML1 < Test::Unit::TestCase > ... > end > rescue LoadError > puts "No xml library..." > end > > I think that's as compact and streamlined as I can get it :-) > > > > David > > -- > David A. Black / Ruby Power and Light, LLC > Ruby/Rails consulting & training: http://www.rubypal.com > Now available: The Well-Grounded Rubyist (http://manning.com/black2) > "Ruby 1.9: What You Need To Know" Envycasts with David A. Black > http://www.envycasts.com > > Yes indeed! Thanks! Diana --000e0cd217a4c3289a046d85734e--