From: Florian Frank Date: 2002-10-30T07:41:20+09:00 Subject: Re: Dynamically executed methods in Ruby? On 2002-10-30 07:05:10 +0900, Mirian Crzig Lennox wrote: > I want to write a class with a method, say "method_handler" which > "traps" all calls to undefined methods and executes them somehow. For > example: > > class Foo > def method_handler(meth, *args) > # meth is the symbol representing the name of the method > ... code to determine what happens ... > end > end Try this instead: class Foo def method_missing(meth, *args) # meth is the symbol representing the name of the method ... code to determine what happens ... end end Once again Matz proves to be good in reading programmer' mind. :) -- A theologian is like a blind man in a dark room searching for a black cat which isn't there - and finding it!