Use define_method rather than eval.