Skip to content

Que::Locker.new(options) raises wrong number of arguments (given 1, expected 0) in Ruby 3.0.3 #326

@bjeanes

Description

@bjeanes

AIUI, Ruby 3 does not expand a last-arg hash to kwargs implicitly, and ** is needed here:

(rdbg) Que::Locker.new(options)    # ruby
eval error: wrong number of arguments (given 1, expected 0)
  /bundle/ruby/3.0.0/gems/que-1.0.0.beta5/lib/que/locker.rb:52:in `initialize'
  (rdbg)//bundle/ruby/3.0.0/gems/que-1.0.0.beta5/bin/command_line_interface.rb:1:in `new'
  (rdbg)//bundle/ruby/3.0.0/gems/que-1.0.0.beta5/bin/command_line_interface.rb:1:in `rescue in parse'
nil
(rdbg) options
{:worker_priorities=>[10, 30, 50, nil, nil, nil], :poll_interval=>5}
(rdbg) Que::Locker.new(**options)    # ruby
#<Que::Locker:0x0000ffffba164508
 @connection=
  #<Que::Connection:0x0000ffffb72ded28
  [... snip ...]

Does changing this to Que::Locker.new(**options) break compatibility? Otherwise I think ruby2_keywords def initialize(...) may be the way to go.


Side-note, this was really frustrating to debug because there is no stack trace shown.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions