m1k3/modifier-refactoring — pull request #1 by m1k3 (2014-05-11 14:36:52+00:00)
Title: Refactoring

This is my attempt at a refactoring of the original code. It is by no means perfect, but I feel like I've reached a nice point where most parts are neatly separated. I've used up the time I alloted myself to do this (~ 1 workdays worth of work). I've documented my process in the README.md file if you are interested. Following is a brief summary.

1. Since the Combiner collaborator was tested I refactored that first. It merges multiple input enumerator streams into arrays. In each loop it takes an element from all of them and puts it into an output array if its the smallest based on value the key method returns.

2. The combiner is used in the Modifier which uses it to merge multiple input CSV files and modifies the contents based on a set of rules and a few provided variables. It is a weird hodgepodge, obviously changes to accomodate changing requirements (e.g. because it now sorts a single input file its locked into having a single input - however it uses the Combiner collaborator and supported multiple input files at some point)

3. I added some niceties (rake task to run the job, Gemfile etc.), moved the code to its namespace, got a simple acceptance test running and split out the work into a few collaborators. I refactored obvious parts and I feel like there are enough seams to change to code in the future. Since I ran out of the time I alloted myself to do this I submitted this pull request and you the link...