I am developing a gem where I need to redefine the <=> operator for
Proc. This operator shows up in the methods list when I print the
output of methods call but I don’t see it in the list of private or
protected methods.
I know in Ruby 1.9 === operator has been redefined, but I am not able
to confirm that <=> is currently implemented in Ruby 1.9. I don’t want
to over-ride the hat operator if it is already implemented for Proc.
Could someone please give me some pointers?
I am developing a gem where I need to redefine the <=> operator for
Proc. This operator shows up in the methods list when I print the
output of methods call but I don’t see it in the list of private or
protected methods.
If you do Proc.instance_method(:<=>), what do you get? If nil, then
it’s not overridden.
Cheers
robert
irb(main):005:0> p = Proc.instance_method(:<=>)
NameError: undefined method <=>' for classProc’
from (irb):5:in instance_method' from (irb):5 from /usr/local/bin/irb:12:in’