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