Class: Wixy::Vigenere
- Inherits:
-
Object
- Object
- Wixy::Vigenere
- Defined in:
- lib/wixy/vigenere.rb
Instance Method Summary collapse
- #decrypt(text) ⇒ Object
- #encrypt(text) ⇒ Object
-
#initialize(config = Config.new) ⇒ Vigenere
constructor
A new instance of Vigenere.
Constructor Details
Instance Method Details
#decrypt(text) ⇒ Object
17 18 19 20 |
# File 'lib/wixy/vigenere.rb', line 17 def decrypt(text) shift = -> index, offset { index - offset } solve text, shift end |
#encrypt(text) ⇒ Object
12 13 14 15 |
# File 'lib/wixy/vigenere.rb', line 12 def encrypt(text) shift = -> index, offset { index + offset } solve text, shift end |