From b9adc05f760966506557ce5970bea50d4ac6bbc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan-Iulian=20Alecu?= <165364995+pascalecu@users.noreply.github.com> Date: Wed, 13 May 2026 22:38:30 +0300 Subject: [PATCH] Add Rot13 in Ruby --- archive/r/ruby/rot13.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 archive/r/ruby/rot13.rb 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)