class Enygma::Rotator
Public Class Methods
rotate( key_character_1, key_character_2, offset_character, character ) { |character_index, total_shift| ... }
click to toggle source
# File lib/enygma/helpers/rotator.rb, line 5 def self.rotate( key_character_1, key_character_2, offset_character, character ) character_index = Enygma::CHARACTER_MAP.index(character) total_shift = (key_character_1 + key_character_2).to_i + offset_character.to_i rotation = yield(character_index, total_shift) rotation % Enygma::CHARACTER_MAP.size end