Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove key sorting in CSV.instance #262

Merged
merged 2 commits into from
Nov 16, 2022
Merged

Remove key sorting in CSV.instance #262

merged 2 commits into from
Nov 16, 2022

Conversation

Maumagnaguagno
Copy link
Contributor

@Maumagnaguagno Maumagnaguagno commented Nov 10, 2022

DEFAULT_OPTIONS is a frozen Hash with symbols as keys.
There is no need to convert such keys to strings before sorting.
Note that sorting is not needed for stable implementations of Hash, keys would always be returned in the same entry order.
Sorting removed as all supported Ruby versions implement entry order Hashes.

``DEFAULT_OPTIONS`` is a frozen Hash with symbols as keys.
There is no need to convert such keys to strings before sorting.
Note that sorting is not needed for stable implementations of Hash, keys would always be returned in the same entry order.
We could remove sorting if every supported Ruby implements entry order Hashes.
lib/csv.rb Outdated Show resolved Hide resolved
Only required by old Rubies.

Co-authored-by: Sutou Kouhei <[email protected]>
@Maumagnaguagno Maumagnaguagno changed the title Sort keys without block in CSV.instance Remove key sorting in CSV.instance Nov 11, 2022
@kou kou merged commit 27fb15c into ruby:master Nov 16, 2022
@Maumagnaguagno Maumagnaguagno deleted the sort-symbol-keys branch November 16, 2022 06:42
peterzhu2118 pushed a commit to Shopify/ruby that referenced this pull request Dec 6, 2022
(ruby/csv#262)

``DEFAULT_OPTIONS`` is a frozen Hash with symbols as keys.
There is no need to convert such keys to strings before sorting.
Note that sorting is not needed for stable implementations of Hash, keys
would always be returned in the same entry order.
Sorting removed as all supported Ruby versions implement entry order
Hashes.

Co-authored-by: Sutou Kouhei <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants