comma-csv / comma

Comma is a small CSV (ie. comma separated values) generation extension for Ruby objects, that lets you seamlessly define a CSV output format via a small DSL

Home Page:https://github.com/comma-csv/comma

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby 2.7 keywaord arguments deprecation warnings

PragTob opened this issue Β· comments

Hi there and first thanks for the gem! πŸ‘

Running it with Ruby 2.7 though I get deprecation warnings:

/usr/local/bundle/gems/comma-4.3.2/lib/comma/generator.rb:21: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/usr/local/lib/ruby/2.7.0/csv.rb:533: warning: The called method `generate' is defined here

Seems to be this code:

    def run(iterator_method)
      if @filename
        CSV_HANDLER.open(@filename, 'w', @options) { |csv| append_csv(csv, iterator_method) } && (return true)
      else
        CSV_HANDLER.generate(@options) { |csv| append_csv(csv, iterator_method) }
      end
    end

CSV_HANDLER is the stdlib CSV library and according to the generate docs it just passes the arguments on the new which seems to use kwargs.

So the proposed workaround of the warning message of adding ** to the call seems to work/be ok as I assume the @options are settable from users.