From: sawadatsuyoshi@... Date: 2015-12-22T10:59:21+00:00 Subject: [ruby-core:72431] [Ruby trunk - Bug #11860] Double splat does not work on empty hash assigned via variable Issue #11860 has been updated by Tsuyoshi Sawada. I found more cases (other than via variable) that the double splat does not work on an empty hash. While parenthesis does not cause the issue: [**({})] # => [] expressions more complicated than that seem to cause the issue: [**({} if true)] # => [{}] [**(if true; {} end)] # => [{}] [**(false ? :foo : {})] # => [{}] ---------------------------------------- Bug #11860: Double splat does not work on empty hash assigned via variable https://bugs.ruby-lang.org/issues/11860#change-55725 * Author: Tsuyoshi Sawada * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.3.0preview2 (2015-12-11 trunk 53028) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- When an empty hash is given as a literal, the double splat operates on it, and leaves nothing, which is expected. class String def foo; end end [**{}] # => [] "foo".foo(**{}) # => nil "foo".send(**{}) # => nil However, when an empty hash is given via variable, the double splat retains an empty hash in place. h = {} [**h] # => [{}] "foo".foo(**h) # => wrong number of arguments (given 1, expected 0) "foo".send(**h) # => wrong number of arguments (given 1, expected 0) -- https://bugs.ruby-lang.org/