From: Jean-Hugues ROBERT Date: 2004-04-30T14:04:40+09:00 Subject: Re: coerce(), what protocol to implement it At 04:45 30/04/2004 +0900, you wrote: >Jean-Hugues ROBERT wrote: > >>At 03:45 30/04/2004 +0900, you wrote: >> >>>4) Can I redefine coerce() ? If so, when is it called ? (I tried, >>>it is not called...) > >class MyClass > def initialize(val) > @value = val > end > > def coerce(other) > [other, @value] > end >end > >1 + MyClass.new(5) >#=> 6 For me too. I must have been sleeping when I tried it. Thanks ! >>>Google "ruby coerce" provided little help. >You can find some information by searching the ruby-talk archives >http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml for coerce. That link does not work for me :-( I tried with Search (Namazu): coerce => Namazu: a Full-Text Search Engine This index contains 0 documents and 0 keywords. I tried with (Recent 1000 files, Regular Expression): coerce => TIMEOUT may occur. Using Netscape is recommended. I tried (Subjects, Regular Expression): coerce => TIMEOUT may occur. Using Netscape is recommended. It had happened to me before. I must be out of luck today too ;-) Thanks anyway. Jean-Hugues >HTH > >-- >Mark Sparshatt ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17