nebulab/simple_command

Using Ruby 3 style keyword arguments raises warning in Ruby 2.7

rgraff opened this issue · 1 comments

class ExampleCommand
  prepend SimpleCommand
  def initialize(foo:)
    @foo = foo
  end
  def call
    @foo
  end
end

irb(main):010:0> ExampleCommand.call(foo: "bar")
/usr/local/bundle/gems/simple_command-0.1.0/lib/simple_command.rb:9: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
(irb):3: warning: The called method `initialize' is defined here
=> #<ExampleCommand:0x0000560f7af7f988 @foo="bar", @called=true, @result="bar">

The issue is describe here: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

The warning is in 2.7 and will error in 3.0

PR here: #28