(maint) Code cleanup around PMT generate.

Prior to this commit, there were some areas of the generate code that
were less than clear and in need of some further documentation, in
addition to a few others where more idiomatic Ruby was desirable. This
commit exists to make these changes.