From: Robert Klemme Date: 2007-11-07T21:41:29+09:00 Subject: Re: define_method 2007/11/7, Malcolm Lockyer : > Hi Guys, > > I am trying to use define_method like: > > class TestClass > def initialize > define_method("hello") { || puts "Hello" } > end > end > > x = TestClass.new > x.hello > > I am always getting: > NoMethodError: undefined method `define_method' > > Do I need to require something? Am I doing something wrong, or am I > completely missing the boat!? Is this really your use case? Since you know which method you define, you can do it with a normal def anyway. So I suspect that you are doing something else. What exactly is it? Kind regards robert -- use.inject do |as, often| as.you_can - without end