Implement sorting using twitter_cldr
#32
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a draft PR since it does not necessarily overlap with the goals of this gem.
Using
twitter_cldr
we can solve #20 and partly #18. #20, because we can now pass a German collator and the result will be correct.Case insensitive sorting is only partly solved as can be seen in the new specs. Lower case letters are sorted before upper case letters, however this might give surprising results, depending on your use case. As you can see, "öl3" is not after "Öl2", because aforementioned rule.
Before implementing
self.sort_with_collator
I tried using the implementation using a collator as the general case and all specs passed, so it seems that it could potentially be extended to have all methods take an optional collator. I didn't go that far for this PR since it might collide with the goals of this gem as it introduces an optional gem dependency.Maybe it can also serve others as a pointer on how to solve similar issues.