Skip to content
New issue

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

Hash#each raises ArgumentError with a method of arity 2 converted to a block #5896

mvz opened this issue Sep 29, 2019 · 0 comments


Copy link

commented Sep 29, 2019


Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
jruby (2.5.3) 2019-02-11 15ba00b OpenJDK 64-Bit Server VM 11.0.5-ea+6-post-Debian-2 on 11.0.5-ea+6-post-Debian-2 [linux-x86_64]
JAVA_OPTS=" --add-opens java.base/ --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/ --add-opens java.base/ --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/ --add-opens java.base/java.nio.channels.spi=ALL-UNNAMED --illegal-access=warn"
  • Operating system and platform (e.g. uname -a)
Linux bean 5.2.0-2-amd64 #1 SMP Debian 5.2.9-2 (2019-08-21) x86_64 GNU/Linux

Expected Behavior

Given the following Ruby script:

class Bar
  def foo
    { a: 1, b: 2}.each(&method(:bar))

  def bar(a, b)
    puts "#{a}: #{b}"

CRuby has the following output:

a: 1
b: 2

Actual Behavior

JRuby has the following output:

ArgumentError: wrong number of arguments (given 1, expected 2)
     bar at foo.rb:3
    each at org/jruby/
     foo at foo.rb:3
  <main> at foo.rb:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.