Here's my proposal. I've added an argument for specifying whether the added method should be a singleton one or not. The name `create_and_define_method` is rather poor but I haven't got a better idea; I'm open for improvements in this matter.