diff --git a/archive/r/ruby/rot13.rb b/archive/r/ruby/rot13.rb new file mode 100644 index 000000000..6bedc091f --- /dev/null +++ b/archive/r/ruby/rot13.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +USAGE = "Usage: please provide a string to encrypt" + +def usage! + warn USAGE + exit 1 +end + +def rot13(str) + str.tr("A-Za-z", "N-ZA-Mn-za-m") +end + +input = ARGV.first +usage! if input.nil? || input.strip.empty? + +puts rot13(input)