ruby-reference-manual:2937
From: okkez _ <redmine@r...>
Date: Tue, 13 Dec 2011 20:17:50 +0900
Subject: [ruby-reference-manual:2937] [るりまプロジェクト - Bug #5498][Closed] Proc#yield のサンプルコード実行結果がおかしい
Issue #5498 has been updated by okkez _. Category set to doc Status changed from Open to Closed Assignee set to okkez _ % Done changed from 0 to 100 r4934 で修正しました。 ---------------------------------------- Bug #5498: Proc#yield のサンプルコード実行結果がおかしい http://redmine.ruby-lang.org/issues/5498 Author: Hiroshi Koyama Status: Closed Priority: Normal Assignee: okkez _ Category: doc Target version: reporter: ruby_version: http://doc.ruby-lang.org/ja/1.9.2/method/Proc/i/yield.html > pr = Proc.new {|a,b,c| p [a,b,c]} > pr.yield(1) #=> [1, nil, nil] > pr.yield(1,2,3,4) #=> [1, 2, 3] > pr.call(1) #=> wrong # of arguments (4 for 3) (ArgumentError) pr.call(1)の呼び出しでArgumentErrorが 発生すると書かれているけど、発生しませんぽよ。 # ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] # cat test.rb pr = Proc.new {|a,b,c| p [a,b,c]} pr.yield(1) #=> [1, nil, nil] pr.yield(1,2,3,4) #=> [1, 2, 3] pr.call(1) #=> wrong # of arguments (4 for 3) (ArgumentError) # ruby test.rb [1, nil, nil] [1, 2, 3] [1, nil, nil] (rootなのはワケアリ) -- http://redmine.ruby-lang.org -- ML: ruby-reference-manual@m... Info: http://QuickML.com/