Hi, I can't understand it:
class String
def =~ obj
puts "Sorry, I don't compare"
end
end
a) OK
irb> "string" =~ 1234
Sorry, I don't compare
nil
b) ¿?
irb> "string" =~ /string/
0
c) OK
irb> "string".send(:"=~", 1234)
Sorry, I don't compare
nil
d) OK
irb> "string".send(:"=~", /string/)
Sorry, I don't compare
nil
Could I know why case "b" perform the normal regexp comparission instead of
invoking the re-defined String#=~ method??
Thanks.
--
Iñaki Baz Castillo