From: mame@... Date: 2020-04-01T15:54:35+00:00 Subject: [ruby-core:97662] [Ruby master Bug#16748] Different behaviour between a hash and multi-Array when passing 2 arguments to a proc Issue #16748 has been updated by mame (Yusuke Endoh). Status changed from Open to Rejected The behavior of 2.5.5 was wrong. `Array#map` yields each element, in this case, `['one', 'two']`, an array of two elements. The lambda requires two arguments, but one array is passed, which should raise "wrong number of arguments". You may want to use `-> (ary) { ary[0] }` instead of `-> (one, two) { one }`. Or you can use `proc {|one, two| one }`. ---------------------------------------- Bug #16748: Different behaviour between a hash and multi-Array when passing 2 arguments to a proc https://bugs.ruby-lang.org/issues/16748#change-84869 * Author: Mattruby (Matthew Nash) * Status: Rejected * Priority: Normal * ruby -v: 2.7.0 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- In Ruby 2.5.5 i get what i'm expecting ```ruby test = -> (one, two) { one } [['one', 'two']].map(&test) => ["one"] ``` In Ruby 2.7.0 this doesn't work ```ruby test = -> (one, two) { one } [['one', 'two']].map(&test) wrong number of arguments (given 1, expected 2) (ArgumentError) ``` ---Files-------------------------------- Screen Shot 2020-04-01 at 16.47.37.png (205 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: