

Show HN: Two line ruby quine - madamepsychosis

Thought you might like this. This Ruby program makes an exact copy of itself.<p>c = "File.open('new.rb', 'w') {|f| f.write('c = ' + c.inspect + '\neval c') }"<p>eval c
======
AndrewVos
I think the use of eval is thought of as cheating. Also I seem to remember
writing to files is also cheating?

~~~
madamepsychosis
not sure about fixing the eval part, but reading the source code is usually
thought of as cheating. However, that's not what this is doing. It could
easily be changed to:

c = "puts('c = ' + c.inspect + '\neval c')" eval c

