Class: Crypt::Rot13
- Inherits:
-
String
- Object
- String
- Crypt::Rot13
- Defined in:
- lib/crypt/rot13.rb
Constant Summary collapse
- VERSION =
"1.0.1"
Instance Method Summary collapse
-
#initialize(str = "", degree = 13) ⇒ Rot13
constructor
Returns a new Rot13 object.
-
#rotate(degree) ⇒ Object
Rotates the object by
degree
.
Constructor Details
#initialize(str = "", degree = 13) ⇒ Rot13
Returns a new Rot13 object. The object is a string with the letters each rotated by degree
.
You cannot use a multiple of 26 as the degree or a Rot13Error will be raised. So, your days of double rot13 encryption are over.
11 12 13 14 15 16 |
# File 'lib/crypt/rot13.rb', line 11 def initialize(str="", degree=13) unless str.empty? str = rotate_string(str, degree) end super(str) end |
Instance Method Details
#rotate(degree) ⇒ Object
Rotates the object by degree
.
19 20 21 |
# File 'lib/crypt/rot13.rb', line 19 def rotate(degree) rotate_string(self,degree) end |