Add Generator_Builder::globals() method

This simplifies the code and makes testing easier, among other things.