From: R.. Kumar 1.9.1 OSX on 28 Jul 2010 14:38
I've been checking respond_to? before calling send() for ages but today
its failing in a simple case.
I define a method outside of a class or module. send() works but
respond_to? fails. You could define a method in irb and check for
Where are these methods getting defined if not in Object?
Here's a snippet you can try:
puts "inside testme"
if respond_to? :testme
I just tried out "defined? :testme" and that works, but I'd still like
to know which is better to use, and why respond_to fails.
Posted via http://www.ruby-forum.com/.