public
Description: Ruby: sort UTF8 Strings alphabetical via Enumerable extension
Homepage:
Clone URL: git://github.com/grosser/sort_alphabetical.git
grosser (author)
Sun Nov 22 01:39:19 -0800 2009
commit  4f85331fca1e20213e399124331fd05db939f961
tree    5bf6474412ca326dd44adefe041779870b5ca707
parent  1c05f5b0d9d89df6c285ca70ee243a42c0da1d5b
name age message
file README.markdown Sun Nov 22 01:39:13 -0800 2009 gemcutter is default now hurray [grosser]
file Rakefile Sun Nov 22 01:39:13 -0800 2009 gemcutter is default now hurray [grosser]
file VERSION Mon Sep 07 12:03:14 -0700 2009 docs update + version bump to get github gem bu... [grosser]
file init.rb Wed Nov 18 02:05:23 -0800 2009 make to rails plugin, distribute using gemcutter [grosser]
directory lib/ Wed Mar 18 03:02:43 -0700 2009 basics working... [grosser]
file sort_alphabetical.gemspec Sun Nov 22 01:39:19 -0800 2009 Regenerated gemspec for version 0.1.1 [grosser]
directory spec/ Wed Nov 18 02:03:52 -0800 2009 use spectask to better run on ci server [grosser]
README.markdown

Adds sort_alphabetical and sort_alphabetical_by to Enumberable(Array/Hash...),
which sorts UTF8 Strings alphabetical.
This sorting is done by placing variants on the same level as base character (A comes before Ä but ÄA comes before AB).

Setup

  • As Rails plugin: script/plugin install git://github.com/grosser/sort_alphabetical.git
  • As gem: sudo gem install sort_alphabetical

Usage

['b','á'].sort_alphabetical == ['á','b']
[['b',1],['á',2]].sort_alphabetical_by(&:first) == [['á',2],['b',1]]

TODO

  • Sort non-ascii-convertables like ß(ss), œ(oe) , fi(fi), see Ligatures
  • Integrate natural sorting e.g. ['a11', 'a2'] => ['a2', 'a11'] like NaturalSort

Authors

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...