Avoid using define_method to stop memory leak.

Analysis of Ruby's ObjectSpace found that simply loading LWRPs were
creating ResourceCollections and other objects that were not being
garbage collected.  Bisecting the code identified the define_method on
initialize as the culprit.

This patch repalces the define_method with a class_eval of a string.
It isn't pretty but it appears to resolve the known test cases for
this memory leak.