Skip to content

Add mutation of #map to #to_set #1241

Open
@dkubb

Description

The Enumerable#to_set method can accept a block like Enumerable#map and it will return a Set containing unique entries.

If the return value of #map (a) Doesn't need to include duplicates or (b) Needs to be an Array because the public interface of the method says it must be an Array, then we would expect appropriate tests to ensure this property holds.

If neither of these is the case, then a Set can often function just as well as an Array, and perhaps even better if the assumption is that there can be no duplicate entries.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions