From: Pat Maddox Date: 2006-08-07T03:16:33+09:00 Subject: Singleton methods with method_missing I don't have any practical use for this, but I was experimenting a bit. I just want to create singleton methods on objects of this class. There's more to come, but this is the part I'm stuck at :) This code doesn't actually work, but I think it's close (I hope?) class OneShot def method_missing(m) class << self define_method(m) { puts m.to_s } end send(m) end end When I do this I get "NameError: undefined local variable or method `m' for #>" so I think it means that m just isn't in scope for the singleton class. How can I define the singleton method? Is there any way to use binding here? Pat -- Posted with http://DevLists.com. Sign up and save your mailbox.