We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enumerable#each_entry yields different from MRI value for no arguments.
Enumerable#each_entry
Ran using docker image, ruby -v: rubinius 3.72 (2.3.1 6d56979 2017-02-21 3.8.0) [x86_64-linux-gnu]
ruby -v
test file:
class Foo include Enumerable def each yield 1 yield 1, 2 yield end end out = [] Foo.new.each_entry{ |*args| out << args } puts "each_entry: #{out.inspect}"
Expected output:
==[1.9.3-p551]== each_entry: [[1], [[1, 2]], [nil]] ==[2.0.0-p648]== each_entry: [[1], [[1, 2]], [nil]] ==[2.1.10]== each_entry: [[1], [[1, 2]], [nil]] ==[2.2.6]== each_entry: [[1], [[1, 2]], [nil]] ==[2.3.3]== each_entry: [[1], [[1, 2]], [nil]] ==[2.4.0]== each_entry: [[1], [[1, 2]], [nil]]
Rubinius output:
each_entry: [[1], [[1, 2]], [[]]]
I suggest following change:
diff --git core/enumerable.rb core/enumerable.rb index 2234f9b61d..a35e2eb1ff 100644 --- core/enumerable.rb +++ core/enumerable.rb @@ -67,8 +67,8 @@ module Enumerable def each_entry(*pass) return to_enum(:each_entry, *pass) { enumerator_size } unless block_given? - each(*pass) do |*element| - yield element.size == 1 ? element[0] : element + each(*pass) do |*elements| + yield elements.size > 1 ? elements : elements[0] end self end
Related: jruby/jruby#4532
The text was updated successfully, but these errors were encountered:
@toy Thanks for your reporting! Sorry to late response 🙇 We fixed the problem in #3761.
Sorry, something went wrong.
No branches or pull requests
Enumerable#each_entry
yields different from MRI value for no arguments.Ran using docker image,
ruby -v
:rubinius 3.72 (2.3.1 6d56979 2017-02-21 3.8.0) [x86_64-linux-gnu]
test file:
Expected output:
Rubinius output:
I suggest following change:
Related: jruby/jruby#4532
The text was updated successfully, but these errors were encountered: