Skip to content

Instantly share code, notes, and snippets.

@pimeys
Created December 1, 2011 15:36
Show Gist options
  • Save pimeys/1417623 to your computer and use it in GitHub Desktop.
Save pimeys/1417623 to your computer and use it in GitHub Desktop.
Quine for ruby
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