From: Brian Candler Date: 2007-03-07T20:00:01+09:00 Subject: Re: object_* and instance_* methods On Wed, Mar 07, 2007 at 07:46:56PM +0900, Brian Candler wrote: > And this is straightforward to implement: Alternatively, make your own methods on the objects themselves, giving them whatever consistent naming scheme you feel like: class Object def meta_class Object.instance_method(:class).bind(self).call end def meta_send(*args) Object.instance_method(:send).bind(self).call(*args) end #def method_missing(meth, *args) # return Object.instance_method($1).bind(self).call(*args) if # /^meta_(.*)$/ =~ meth.to_s # raise NoMethodError, "undefined method '#{meth}' for #{inspect}" #end end class Foo def send(*args) "whoo!" end def class "stupid!" end end f = Foo.new puts f.class # stupid! puts f.meta_class # Foo puts f.send(:object_id) # whoo! puts f.meta_send(:object_id) # -605608944