Moved the delta generation code into a module and started test framework

  Old code was not split very well so I extracted the helper methods to a
  module and cleaned up the code. I also started rewriting the main code to
  be a bit more in line with Ruby standards and added a pending test.