From: Robert Klemme Date: 2007-08-07T21:45:29+09:00 Subject: Re: Better way to do this? Currently using two method_missing calls... 2007/8/7, Dan : > On Aug 6, 2:53 am, "Robert Klemme" wrote: > > 2007/8/4, Dan : > > > > > Ok, I see where you were going now. I guess I could go in that > > > direction, but since sending functions and objects to the web service > > > is just done via POST params, so I'd rather route all the requests to > > > the "call" class method on my API class. Any ideas on how to do this > > > without having to create a instance of the API class (or any class) > > > just to store the "object" name ? > > > > This is what I'd do (attached). Note, you need to know the number of > > invocations in this example. The pattern could however use other > > criteria for triggering the action. > > > > Kind regards > > > > robert > > > > call-recorder.rb > > 1KDownload > > Hi Robert, > > Thanks for the reply. I was wondering if that there was a way to do > this sort of thing in ruby without having to create a class instance > just to store the method calls. However, it looks like that's not > possible, which I kind of understand. Not perfect for my situation, > but it should be good enough. Can you explain why you are reluctant to create an instance for this? Generally, creating and manipulating objects is all OO is about. :-) More specifically, since your remote call is likely an order of magnitude slower than the instance creation performance effects are negligible. Kind regards robert