From: Gavri Savio Fernandez Date: 2003-11-29T03:57:39+09:00 Subject: Re: getting method names > From: Shashank Date [mailto:sdate@everestkc.net] > Subject: getting method names > > > How do I get the name of the missing method inside the > missing_method > method? > > class Foo > def missing_method(*args) > puts " <#{???}> method is not yet implemented" > # ^^^^^^ What should I put here? > end > end > > f = Foo.new > f.boo # This should print " method is not yet implemented" From the pragmatic programmer's guide: ################################################################## method_missing obj.method_missing( aSymbol [, *args ] ) -> anObject Invoked by Ruby when obj is sent a message it cannot handle. aSymbol is the symbol for the method called, and args are any arguments that were passed to it. ################################################################### #code sample start class Foo def method_missing(s, *args) puts s end end f = Foo.new f.random_name #code sample end when executed this gives random_name as output > > TIA, > -- shanko > Gavri Savio Fernandez ___________________________________________ If only God would give me some clear sign! Like making a large deposit in my name at a Swiss bank. - Woody Allen