Clean up the constructor regex and a bit more code reorganization

Put just the Rails engine require in a conditional instead of the
entire file. This will make testing easier when I actually write some :)