Refactoring Generators::Base.

The defaults hash isn't used unless the +class_options+ hash has a
particular key, so we don't need to compute it unless this is true.

Also moving some code for extracting a module into its own method.