Split out new .rb file

This is the beginning of a refactoring.  Splitting out a .rb file so we
can get better syntax checking etc.