From: Daniel Baird Date: 2006-08-22T10:05:13+09:00 Subject: Re: working around "single-pass" constraint On 8/22/06, ara.t.howard@noaa.gov wrote: > > if you take tis to the next step it's really useful > > class Main > def foo > end > def bar > end > def run > foo and bar > end > end > > Main.new(ENV, ARGV).run if $0 == __FILE__ > > > the reason is that it allows your program to be used as a library without > polluting the global namespace. I agree, but the OP wants to see the main algorithm at the top of the file (at least, I think that's the idea), so "run" should be at the top: class Main def run foo and bar end def foo end def bar end end Main.new(ENV, ARGV).run if $0 == __FILE__ Neat and Tidy.. Tidy and Neat ( http://pages.eidosnet.co.uk/pobotrol/whomessy.htm ) -- Daniel Baird http://tiddlyspot.com (free, effortless TiddlyWiki hosting) http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog :: Things That Suck)