On Oct 27, 2008, at 10:15 AM, Robert Klemme wrote:

> :-)
>
> I believe OP rather wanted to test for existence of the same method in
> the superclass.  Although I have to say I am not 100% sure what he's
> after since the testing without instance seems strange.
>
> An alternative would be to invoke it and rescue NoMethodError.
> Another route would be to use instance_method but that might be
> fragile.
>
> Kind regards
>
> robert


precisely what 'defined?(super)' does....

cfp:~ > cat a.rb
class A
   def foo() end
end

class B < A
   def foo() defined?(super) ? true : false end
end

class C
   def foo() defined?(super) ? true : false end
end

p B.new.foo
p C.new.foo



cfp:~ > ruby a.rb
true
false


cheers.

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama