From: Girard Fred Date: 2007-12-07T23:16:14+09:00 Subject: Re: function like "function_exits" Jordan Callicoat wrote: > On Dec 7, 7:31 am, Girard Fred wrote: >> > Regards, >> -------------------- >> >> Posted viahttp://www.ruby-forum.com/. > But you don't really want that... ;) > > You want respond_to? which Just Works everywhere. And really, you > probably don't even want to be asking if a method is defined (depends > on your code), but usually there are better ways of doing things (like > unit testing). > > HTH, > Jordan No it's ok, i am happy with that, if i really want, i can merge these 2 methods: def foo() puts 'test' end def function?(function_name) return true if private_methods.include?(function_name) return true if methods.include?(function_name) return false end puts function?('foo') => true puts function?('notfoo') => false puts function?('puts') => true It's nice to learn a new language like that, thank you so much (and sorry for my poor english) :) -- Posted via http://www.ruby-forum.com/.