From: Akinori MUSHA Date: 2007-03-01T03:58:22+09:00 Subject: [ruby-list:43241] Re: Ruby 1.8.6 preview2 has been released At Thu, 1 Mar 2007 02:36:15 +0900, I wrote: > At Thu, 1 Mar 2007 00:56:15 +0900, > Takahiro Kambe wrote: > > require 'digest/sha1' > > > > class MySecret < Digest::SHA1 > > s = Digest::SHA1.new("naisho") > > Saisho = s.digest > > > > ... > > > > def initialize > > self.update(Saisho) > > end > > end > > > > なんて、コードが動かなくなりました。new("...")は書き換えましたが、 > > MySecretのインスタンスを作成しようとすると、エラーが起きるようになりま > > した。 > >  これは実装の不備でした。修正します。  皮肉なことに、 - まず Ruby で Digest::Base を継承できるようにし、 - 次に Digest::Base から Digest::Class と Digest::Instance を 分離する という変更の過程で、 Digest::Base のサブクラスを Ruby から継承 できなくなっていました。(Digest::Base を Ruby から直接継承する のは不可でOK)  trunk, ruby_1_8, ruby_1_8_6 に修正を入れました。これで以下の コードが動きます。 class MySecret < Digest::SHA1 Saisho = Digest::SHA1.digest("naisho") def initialize self.update(Saisho) end end -- / /__ __ Akinori.org / MUSHA.org / ) ) ) ) / FreeBSD.org / Ruby-lang.org Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp "Different eyes see different things, Different hearts beat on different strings -- But there are times for you and me when all such things agree"