Skip to content

Instantly share code, notes, and snippets.

@jasonblanchard
Created November 8, 2014 21:50
Show Gist options
  • Select an option

  • Save jasonblanchard/11228b6ccaac77670ffe to your computer and use it in GitHub Desktop.

Select an option

Save jasonblanchard/11228b6ccaac77670ffe to your computer and use it in GitHub Desktop.
class ROT13
def self.translate(string)
output = string.split('').map do |character|
if alphabet.include? character
alphabet[(alphabet.index(character) + 13) % 26]
else
character
end
end.join
puts output
end
def self.alphabet
('a'..'z').to_a
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment