From: Jamis Buck Date: 2003-12-11T12:38:37+09:00 Subject: Re: Ideas for replacing $0==__FILE__ Austin Ziegler wrote: >>If you add -t to the ruby interpreter (ruby -t foo.rb) then __TEST__ get >>run when ruby exits. ($TEST would also be set like -d sets $DEBUG). >> >> > >Hm. I'm not sure I like that. Why not: > >TEST { > ... >} > >The block is only run with ruby -t ...; otherwise it works just like BEGIN >{} and END {} blocks. > > I like that--in fact, I'd probably use it. What happens if there are multiple TEST{} blocks (especially in required files)? Do they all get executed? -- Jamis Buck jgb3@email.byu.edu ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'