From: HarryO Date: 2001-11-17T04:48:54+09:00 Subject: [ruby-talk:25630] Re: Creating methods on the fly Can someone explain why the following code fails to define the new method jim() in class Mary? Can you suggest how it can be done? When I run this, I get an error saying there's no method "jim" in that class. def fred(object) name = "jim" class << object eval %{ puts "Creating method #{name}() ..." def #{name}(*arguments) puts "jim() -- hello there!" end } end end class Mary def initialize end end fred(Mary) m = Mary.new m.jim()