Skip to content

Ruby >=3 handles positional args vs keyword args differently, users may run into an error with the comments in the config #56

Description

@inveterateliterate

Initializer Template includes guidance liek the below:

# Examples:
  # config.add_tokenable_options :confirm, TokenMaster::Config::DEFAULT_VALUES

However, because of the way the second argument (a hash) is deconstructed in lib/config:

def add_tokenable_options(key, **params)
      @options[key] = params
    end

This results in a conflict with the way Ruby 3.1 is passing those options along:
https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

The fix for the user is to splat their options in the initializer like so:
config.add_tokenable_options :confirm, **TokenMaster::Config::DEFAULT_VALUES

creating an issue in here in case there's an option to update the core code to support either approaches, for example not double-splatting and setting the default to be the TokenMaster default

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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