Brian Candler <b.candler / pobox.com> writes:

> James Gray wrote:
>> On May 31, 2009, at 10:59 PM, Jorrel wrote:
>> 
>>> Is using File considered cheating?
>>>
>>>    puts File.readlines __FILE__
>> 
>> It usually is, yes.
>
> I'd suggest you pipe the source code into the ruby interpreter:
>
>     cat quine.rb | ruby
>
>     cat quine.rb | ruby | diff -u quine.rb -
>
> That eliminates tricks with __FILE__ and $0.

A better solution would be to compile the ruby program. Then $0 would
be a binary file and that trick would fail.

-- 
__Pascal Bourguignon__