(maint) Remove code duplication in lib/puppet/type/yumrepo.rb.

Prior to this commit, four different blocks in yumrepo.rb contained multiple
lines of nearly identical code.  This commit consolidates this code,
eliminating the duplication using an array of hashes.