Skip to content

Instantly share code, notes, and snippets.

@magnusstahre
Forked from rdammkoehler/rot13.rb
Created September 17, 2011 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magnusstahre/1224172 to your computer and use it in GitHub Desktop.
Save magnusstahre/1224172 to your computer and use it in GitHub Desktop.
Teaching my 10yr old daughter about ROT-13
class String
def rot13
tr 'abcdefghijklmnopqrstuvwxyz', 'nopqrstuvwxyzabcdefghijklm'
end
end
describe 'String#rot13' do
let (:message) { "the quick brown fox jumps over the lazy dog" }
let (:encoded) { "gur dhvpx oebja sbk whzcf bire gur ynml qbt" }
specify do
message.rot13.should == encoded
end
specify do
encoded.rot13.should == message
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment