From: Dan Date: 2007-08-04T08:50:05+09:00 Subject: Better way to do this? Currently using two method_missing calls... Hi, I'm building a wrapper around a web service and I'd like to have my class simply pass through calls to the remote service (since the remote service will be adding new objects and methods faster then I'll be updating the library, I need my class to be accept anything). For example, if my ruby class is named API, I want to be able to call API.images.find_by_name and have my class pass along "images" and "find_by_name" to the remove service. I've got this working using two method_missing calls (one as a class method and one as an instance method), but it looks sloppy and I was wondering if there was a better way to do this. Any ideas? class API def self.method_missing(remote_object) api = API.new api.instance_variable_set("@remote_object", remote_object) return api end def method_missing(remote_method, *args) API.call(@remote_object, remote_method, args) end def self.call(remote_object, remote_method, args) puts "#{remote_object}.#{remote_method} #{args}" end end Thanks! Dan