Optimization of generated?

This pull request reorganizes the methods called in `generated?` to only load the data (calls to `lines`) in last resort.
Oops, forgot the test helper :/