Module: RotorMachine

Defined in:
lib/rotor_machine.rb,
lib/rotor_machine/rotor.rb,
lib/rotor_machine/factory.rb,
lib/rotor_machine/machine.rb,
lib/rotor_machine/session.rb,
lib/rotor_machine/version.rb,
lib/rotor_machine/plugboard.rb,
lib/rotor_machine/reflector.rb

Overview

The RotorMachine gem is a relatively simple implementation of the German WWII “Enigma”-style of rotor-based encryption machine.

I wrote RotorMachine primarily as an exercise in Test-Driven Development with RSpec. It is not intended to be efficient or performant, and I wasn’t striving much for idiomatic conciseness. My aims were fairly modular code and a relatively complete RSpec test suite.

The documentation for Machine shows an example of how to use the module.

Many thanks to Kevin Sylvestre, whose blog post helped me understand some aspects of the internal workings of the Enigma and how the signals flowed through the pieces of the machine.

Author:

Defined Under Namespace

Modules: Factory Classes: Machine, Plugboard, Reflector, Rotor, Session

Constant Summary collapse

VERSION_DATA =
[1, 2, 0]
VERSION =
VERSION_DATA.join(".")

Class Method Summary collapse

Class Method Details

.Session(opts = {}, &block) ⇒ Object

The class method Session is the entrypoint for the DSL. When invoked with a block, it creates a new Session object, passes the block to it to be run with instance_eval, and then the Session object is returned to the caller.



158
159
160
# File 'lib/rotor_machine/session.rb', line 158

def self.Session(opts={}, &block)
  RotorMachine::Session.new(opts, &block)
end