Created
December 1, 2011 15:36
-
-
Save pimeys/1417623 to your computer and use it in GitHub Desktop.
Quine for ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q = 39 | |
l = [ | |
'q = 39', | |
'l = [', | |
' ', | |
']', | |
'', | |
'l.each_with_index do |line, index|', | |
' if index == 2', | |
' l.map{|line_| " " + q.chr + "#{line_}" + q.chr}.join(",\n").split("\n").each{|line_| puts line_}', | |
' else', | |
' puts line', | |
' end', | |
'end' | |
] | |
l.each_with_index do |line, index| | |
if index == 2 | |
l.map{|line_| " " + q.chr + "#{line_}" + q.chr}.join(",\n").split("\n").each{|line_| puts line_} | |
else | |
puts line | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment