From: Daniel Waite Date: 2007-10-26T04:32:07+09:00 Subject: Re: Need help understanding metaclassing Daniel Waite wrote: > cs.instance_eval do > define_method(:eat) do > puts "You eat." > end > end > > cs.eat # => errors: > NoMethodError: undefined method `eat' for > #> > > Why is that? I've tried class_eval, too and I get the same thing. I > thought I understood this stuff pretty well but I guess not. This works: cs.instance_eval do def eat puts "You eat." end end cs.eat # You eat. What's up with define_method? -- Posted via http://www.ruby-forum.com/.