Skip to content

Instantly share code, notes, and snippets.

@uiur
Created May 24, 2012 10:48
Show Gist options
  • Save uiur/2780797 to your computer and use it in GitHub Desktop.
Save uiur/2780797 to your computer and use it in GitHub Desktop.
Quine in Ruby
s=%q(;puts "s=%q(#{s})"+s);puts "s=%q(#{s})"+s
require 'rspec'
require_relative 'quine'
describe "quine" do
it "output equals its code" do |variable|
f = File.open("quine.rb")
f.read.should == `ruby quine.rb`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment