From: Eric Hodel Date: 2003-12-11T10:23:32-08:00 Subject: Re: Ideas for replacing $0==__FILE__ --Er97KPJOrxRt+yKZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Austin Ziegler (austin@halostatue.ca) wrote: > On Thu, 11 Dec 2003 06:21:37 +0900, Eric Hodel wrote: > > Hal Fulton (hal9000@hypermetrics.com) wrote: > >>> We also discussed on IRC having a "-t" flag to the ruby interpreter > >>> that would run a TEST block (like BEGIN or END or at_exit), but > >>> __TEST__ seems even better than that. > >> Are we talking about the same thing? In my scheme, if foo.rb had a > >> __TEST___ section, it would be run simply by ruby foo.rb (and not run > >> if foo.rb was require'd). > > This is different than your use. >=20 > >> How does that relate to the -t idea (which I don' quite get)? > > 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). >=20 > Hm. I'm not sure I like that. Why not: >=20 > TEST { > ... > } >=20 > The block is only run with ruby -t ...; otherwise it works just like BEGIN > {} and END {} blocks. This was the original idea. --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Er97KPJOrxRt+yKZ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/2LYkMypVHHlsnwQRAm7LAKDep4NCMl5atXo4KgDZAPWp1V526wCeITs8 4t5Qe5zhEOSxT/ScyAxCIQU= =7DH4 -----END PGP SIGNATURE----- --Er97KPJOrxRt+yKZ--