Skip to content

Instantly share code, notes, and snippets.

@c-lliope
Created November 2, 2015 06:07
Show Gist options
  • Save c-lliope/9915bfef56285ea518fb to your computer and use it in GitHub Desktop.
Save c-lliope/9915bfef56285ea518fb to your computer and use it in GitHub Desktop.
A ruby script that outputs its source code
single_quote = "'"
script = '
first = "single_quote = \"#{single_quote}\""
assignment = "script = " + single_quote
lines = [
first,
assignment,
script.strip,
single_quote,
"eval script",
]
script = lines.join("\n")
puts script
'
eval script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment