From: Tanaka Akira Date: 2008-05-22T23:48:22+09:00 Subject: [ruby-dev:34807] 1.step(3, SimpleDelegator.new(Rational(1,2)) 1.step(3, Rational(1,2)) が例外にならないのに 1.step(3, SimpleDelegator.new(Rational(1,2))) が例外になるの は変ではないでしょうか。 % ./ruby -v -rdelegate -e '1.step(3, SimpleDelegator.new(Rational(1,2))) {|x| p x }' ruby 1.9.0 (2008-05-22 revision 16533) [i686-linux] /home/akr/ruby/yarvo0/lib/ruby/1.9.0/delegate.rb:225: warning: instance variable @delegate_sd_obj not initialized 1 Rational(3, 2) -e:1:in `+': SimpleDelegator can't be coerced into Rational (TypeError) from -e:1:in `step' from -e:1:in `
' % ./ruby -v -e '1.step(3, Rational(1,2)) {|x| p x }' ruby 1.9.0 (2008-05-22 revision 16533) [i686-linux] 1 Rational(3, 2) Rational(2, 1) Rational(5, 2) Rational(3, 1) -- [田中 哲][たなか あきら][Tanaka Akira]