From: Dirk Meijer Date: 2005-11-10T04:18:16+09:00 Subject: Re: method_missing ------=_Part_59806_25223082.1131563892587 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline hi, thanks, the NoMethodError catching works :-) and Mark, the argument has to be sent, otherwise the existing methods wouldn't get the arguments either (it looks like this: eval("Module::#{command}(#{argument})") but the problem is solved then :-) greetings, Dirk. 2005/11/9, Mark Hubbart : > > On 11/9/05, Dirk Meijer wrote: > > hi everyone, > > i've got a small problem and can't figure out how to solve it. > > in my program, you can enter commands, and then it checks if those > commands > > exist within a module.. > > if the command does not exist, it should tell the user that, this gets > me to > > this: > > def method_missing(method,*trash) > > print "Command #{method} not found!\n" > > end > > but when the user enters a command with an argument (only one argument > is > > read), it prints the following: > > Command not found! > > Command not found! > > which doesn't look very nice.. how would i solve this? > > It might help if you post some more of the code, especially that > related to taking the user's input and calling the methods. > > My guess is that it lies in that area; it looks like maybe you are > accidentally "send"ing the argument as a method call. > > cheers, > Mark > > > greetings, Dirk. > > > > > > ------=_Part_59806_25223082.1131563892587--