class EnigmaEncrypto::Rotator
Public Instance Methods
character_map_creation()
click to toggle source
# File lib/enigma_encrypto/rotator.rb, line 4 def character_map_creation @character_map = [] @character_map.concat(("a".."z").to_a) @character_map.concat(("0".."9").to_a) @character_map.concat([" ", ".", ","]) end
reverse_text(text, reversion)
click to toggle source
# File lib/enigma_encrypto/rotator.rb, line 19 def reverse_text(text, reversion) reversion = 0 - reversion rotate_text(text, reversion) end
rotate_text(text, rotation)
click to toggle source
# File lib/enigma_encrypto/rotator.rb, line 15 def rotate_text(text, rotation) rotation_for_text = rotator(rotation) rotation_for_text[text] end
rotator(rotation)
click to toggle source
# File lib/enigma_encrypto/rotator.rb, line 10 def rotator(rotation) character_map_creation rotated_character_map = @character_map.rotate(rotation) Hash[@character_map.zip(rotated_character_map)] end