Skip to content

Defining build_enumerator with keyword arguments example is incorrect #672

@p8

Description

@p8

In the argument semantics guide, passing keyword arguments to build_enumerator is shown as follows:

def build_enumerator(kwargs, cursor:)
name = kwargs.fetch(:name)
email = kwargs.fetch(:email)
# ...
end

However, interruptible_perform calls build_enumerator with a splat:

enumerator = build_enumerator(*arguments, cursor: cursor_position)

This results in the following error:

wrong number of arguments (given 0, expected 1; required keyword: cursor)

Instead I had to define build_enumerator as follows:

 def build_enumerator(*args, cursor:) 
   name = args.dig(0, :name)
   email = args.dig(0, :email)
   # ... 
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions