1.8.8dev e$B$G!"0J2<$N$h$&$K!"e(BEnumerable e$B$Ke(B each2
e$B$rDj5A$7!“e(B
Tempfile e$B$re(B each2 e$B$G7+$jJV$=$&$H$9$k$H!”%V%m%C%/$,8F$P$l$^$;e(B
e$B$s!#e(B
% cat tst.rb
require ‘tempfile’
module Enumerable
def each2(&block)
each(&block)
end
end
t = Tempfile.new(“foo”)
t.puts “a”, “b”, “c”
t.rewind
t.each2 {|x| p x }
% ./ruby -v tst.rb
ruby 1.8.8dev (2009-05-08 revision 23366) [i686-linux]
(e$B$J$K$b=P$F$3$J$$e(B)
each2 e$B$G$J$/!"e(Beach e$B$r;H$($P8F$P$l$^$9!#e(B
% ./ruby -rtempfile -ve ’
t = Tempfile.new(“foo”)
t.puts “a”, “b”, “c”
t.rewind
t.each {|x| p x }
’
ruby 1.8.8dev (2009-05-08 revision 23366) [i686-linux]
“a\n”
“b\n”
“c\n”
e$B$^$?!"e(B1.9 e$B$G$Oe(B each2 e$B$G$b8F$P$l$^$9!#e(B
% ruby -v tst.rb
ruby 1.9.2dev (2009-05-08 trunk 23370) [i686-linux]
“a\n”
“b\n”
“c\n”
e$B$=$7$F!"e(B1.8.1 e$B$G$b8F$P$l$^$9!#e(B
% ruby-1.8.1 -v tst.rb
ruby 1.8.1 (2003-12-25) [i686-linux]
“a\n”
“b\n”
“c\n”
e$B$J$*!"e(B1.8.6p368 e$B$G$Oe(B LocalJumpError e$B$K$J$j$^$9!#e(B
% ruby-1.8.6p368 -v tst.rb
ruby 1.8.6 (2009-03-31 patchlevel 368) [i686-linux]
tst.rb:4:in each': no block given (LocalJumpError) from tst.rb:4:in
each2’
from /home/ruby/186p368/lib/ruby/1.8/delegate.rb:272:in
__send__' from /home/ruby/186p368/lib/ruby/1.8/delegate.rb:272:in
method_missing’
from tst.rb:10
At Sat, 9 May 2009 02:10:21 +0900,
Tanaka A. 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, &block)
end
- 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)
 ã—ã‹ã—〠trunk ã ã‘手当ã¦ã•ã‚ŒãŸã®ã¯ã©ã†ã„ã†ã‚ã‘ã§ã—ょã†ã?
e$B$^$D$b$He(B e$B$f$-$R$m!we(BEuruko09e$B$G$9e(B
In message “Re: [ruby-dev:38391] Re: [Bug:1.8] Tempfile and extended
Enumerable”
on Sat, 9 May 2009 04:06:30 +0900, “Akinori MUSHA”
[email protected] writes:
|Tanaka A. wrote:
|> 1.8.8dev e$B$G!"0J2<$N$h$&$K!“e(BEnumerable e$B$Ke(B each2 e$B$rDj5A$7!“e(B
|> Tempfile e$B$re(B each2 e$B$G7+$jJV$=$&$H$9$k$H!”%V%m%C%/$,8F$P$l$^$;e(B
|> e$B$s!#e(B
|
|e$B!!%V%m%C%/$,EO$5$l$F$$$J$$$N$,860x$J$N$G!”$3$&$9$l$PD>$j$^$9!#e(B
e$B%3%_%C%H$7$F$$$?$@$1$^$;$s$+!)e(B
At Sat, 9 May 2009 21:05:00 +0900,
matz wrote:
コミットã—ã¦ã„ãŸã ã‘ã¾ã›ã‚“ã‹ï¼Ÿ
 ruby_1_8 ã«ã‚³ãƒŸãƒƒãƒˆã—ã¾ã—ãŸã€‚ruby_1_8_7 ãŠã‚ˆã³ ruby_1_8_6 ã«ã‚‚
é©ç”¨ã§ãã¾ã™ã€‚