openlexington/Lex_to_LIVES — pull request #4 by mildmojo (2013-02-24 19:03:28+00:00)
Title: Refactor into a class for external usage

## What's new
This wraps all the logic up into a class so it can be required & used externally. It has a stub so it can still be executed at the command line, taking an input file as an argument.

## Refactor
I ended up moving more stuff around than I'd planned. =) I added Struct-based objects for businesses, inspections, and violations which has the side benefit of making the Lex-to-LIVES mapping clearer. I moved the reading/parsing/writing out into their own methods to make them all smaller.

The CSV read and write methods are left public, mainly for (as-yet-unwritten) tests. The #transform method wraps these two, so a test might want to read-but-not-write, or inject custom data into the transformer before writing. There's probably more to do for testability, like allowing the input and output files to be IO objects so tests could inject StringIO instead of using the filesystem.

:ocean: :ocean: :ocean: