Pretty sure not possible, unless you don't use dot/bracket notation for calling object method but substitute it with some analog of a "send" method:
Object.prototype.__send = function(method){ ... } foo.__send('nonexistent'); // intercept error Another alternative would be to wrap execution with try/catch, then parse error message in catch block (which is unfortunately different across browsers) and proceed as needed : ) - kangax On May 6, 9:57 am, GarethAtFlignet <[EMAIL PROTECTED]> wrote: > Hi all, > > anyone know if it's possible to imitate the very useful PHP __call() > method in protoype? > > For those who are not familiar with PHP, the __call() method is > invoked whenever a method on an object is called and the method does > not exist. For example in PHP: > > class MyClass { > > /** > * @param string $method the name of the called method that did not > exist. > * @param array $params an array of parameters passed to the method > that did not exist. > */ > public function __call($method, $params) { > > } > > } > > Any ideas? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---