From: Akinori MUSHA Date: 2009-05-09T04:06:30+09:00 Subject: [ruby-dev:38391] Re: [Bug:1.8] Tempfile and extended Enumerable --pgp-sign-Multipart_Sat_May__9_04:06:51_2009-1 Content-Type: text/plain; charset=ISO-2022-JP At Sat, 9 May 2009 02:10:21 +0900, Tanaka Akira wrote: > 1.8.8dev で、以下のように、Enumerable に each2 を定義し、 > Tempfile を each2 で繰り返そうとすると、ブロックが呼ばれませ > ん。  ブロックが渡されていないのが原因なので、こうすれば直ります。 Index: lib/delegate.rb =================================================================== --- lib/delegate.rb (revision 23370) +++ lib/delegate.rb (working copy) @@ -151,12 +151,12 @@ class Delegator alias initialize_methods initialize # Handles the magic of delegation through \_\_getobj\_\_. - def method_missing(m, *args) + def method_missing(m, *args, &block) target = self.__getobj__ unless target.respond_to?(m) - super(m, *args) + super(m, *args, &block) end - target.__send__(m, *args) + target.__send__(m, *args, &block) end # @@ -264,11 +264,11 @@ def DelegateClass(superclass) def initialize(obj) # :nodoc: @_dc_obj = obj end - def method_missing(m, *args) # :nodoc: + def method_missing(m, *args, &block) # :nodoc: unless @_dc_obj.respond_to?(m) - super(m, *args) + super(m, *args, &block) end - @_dc_obj.__send__(m, *args) + @_dc_obj.__send__(m, *args, &block) end def respond_to?(m, include_private = false) # :nodoc: return true if super  しかし、 trunk だけ手当てされたのはどういうわけでしょうね? -- Akinori MUSHA / http://akinori.org/ --pgp-sign-Multipart_Sat_May__9_04:06:51_2009-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkoEgssACgkQkgvvx5/Z4e4M0wCfadYcvY2GqWfkOmSNMVuB0zHc pSEAn01FZmvA2dYosBT0Dv1o98opGb/w =nWt/ -----END PGP SIGNATURE----- --pgp-sign-Multipart_Sat_May__9_04:06:51_2009-1--