Optimization of generated?

This pull request reorganizes the methods called in `generated?` to only load the data (calls to `lines`) in last resort.
@aroben Done. What do you think of it?