I'm not 100% sure if I understand correctly, by "moving it to the definition", you mean moving all of it into makeconf.pp where makeconf is defined? If so, without making this module dependent on stdlib or duplicating code from it, the only way to achieve filtering and changing case is by using inline ruby if I'm not mistaken? 
I'm not exactly sure if this results in better readable code. I agree it might not be the best position to do this at template level, but one could argue it's merely ensuring the proper make.conf syntax is generated. Why not do so at the lowest possible level, the template. The end-user of the module shouldn't be bothered by any of these things, the module should ensure it adheres to the Gentoo make.conf syntax no matter what the user might input.