--Boundary-0219z/3OO9Vr/u5/
Content-Type: text/plain;
  charsettf-8"
Content-Transfer-Encoding: quoted-printable
Content-Description: signed data
Content-Disposition: inline

On Thursday 04 December 2003 5:32 pm, Ara.T.Howard wrote:
> > 2. I have a mild dislike for the idiom if $0 == __FILE__ (lines)
> > end -- because I always indent inside an if, and I don't want to
> > indent, and I really just want to say:  break if $0 != __FILE__
>
> agreed.
>
> how about something like
>
> __TEST__
>
> for this?

Ooohh, I like that! =)

(Hmmm... can we implement it in ruby as is? ... using the eval hack 
posted earlier in this thread sort of works, although this is a bit 
ugly):

--- test.rb ---
#!/usr/bin/ruby

def __TEST__(file)
  if $0 == file
    eval DATA.readlines.join("\n"), binding, file
  end
end


--- demo.rb ---
#!/usr/bin/ruby

#!/usr/bin/ruby
require 'test'

puts "1"

__TEST__(__FILE__)
__END__

puts "2"


Then:
$ ./demo.rb
1
2
$ irb
irb(main):001:0> require 'demo'
1
=> true

Not sure how to get around passing __FILE__ in, or having __END__ there 
as well...

-- 
Wesley J. Landaker - wjl / icecavern.net
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2


--Boundary-0219z/3OO9Vr/u5/
Content-Type: application/pgp-signature
Content-Description: signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQA/z91O8KmKTEzW49IRApUqAJ9nvSwfKj94tFT5zawIGfLPgtpgjgCfTv3C
ZDvXhW4m2+F1tqC597XZi0w9
-----END PGP SIGNATURE-----

--Boundary-0219z/3OO9Vr/u5/--