sort_alphabetical 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +4 -0
- data/Rakefile +2 -2
- data/Readme.md +9 -4
- data/VERSION +1 -1
- data/lib/sort_alphabetical.rb +5 -2
- data/sort_alphabetical.gemspec +3 -2
- data/spec/sort_alphabetical_spec.rb +7 -2
- metadata +6 -5
data/.travis.yml
ADDED
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
task :default do
|
2
|
-
sh "RAILS='~>2' bundle && bundle exec rspec spec"
|
3
|
-
sh "RAILS='~>3' bundle && bundle exec rspec spec"
|
2
|
+
sh "RAILS='~>2' && (bundle || bundle install) && bundle exec rspec spec"
|
3
|
+
sh "RAILS='~>3' && (bundle || bundle install) && bundle exec rspec spec"
|
4
4
|
end
|
5
5
|
|
6
6
|
begin
|
data/Readme.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
Adds `sort_alphabetical` and `sort_alphabetical_by` to Enumberable(Array/Hash...),
|
2
|
-
which sorts UTF8 Strings alphabetical.
|
1
|
+
Adds `sort_alphabetical` and `sort_alphabetical_by` to Enumberable(Array/Hash...),
|
2
|
+
which sorts UTF8 Strings alphabetical.
|
3
3
|
This sorting is done by placing variants on the same level as base character (A comes before Ä but ÄA comes before AB).
|
4
4
|
|
5
|
-
|
6
5
|
Setup
|
7
6
|
=====
|
8
7
|
- As Rails plugin: `rails plugin install git://github.com/grosser/sort_alphabetical.git `
|
@@ -13,15 +12,21 @@ Usage
|
|
13
12
|
['b','á'].sort_alphabetical == ['á','b']
|
14
13
|
[['b',1],['á',2]].sort_alphabetical_by(&:first) == [['á',2],['b',1]]
|
15
14
|
|
15
|
+
SortAlphabetical.to_ascii('á') == 'a'
|
16
|
+
|
16
17
|
TODO
|
17
18
|
====
|
19
|
+
- fix specs for 1.9
|
18
20
|
- Sort non-ascii-convertables like ß(ss), œ(oe) , fi(fi), see [Ligatures](http://en.wikipedia.org/wiki/Typographical_ligature)
|
19
21
|
- Integrate natural sorting e.g. `['a11', 'a2'] => ['a2', 'a11']` like [NaturalSort](http://rubyforge.org/projects/naturalsort)
|
20
22
|
|
21
23
|
Authors
|
22
24
|
=======
|
23
25
|
- original string_to_ascii: [Marc-Andre](http://marc-andre.ca/).
|
26
|
+
- [Maxime Menant](https://github.com/maxime-menant)
|
24
27
|
|
25
28
|
[Michael Grosser](http://grosser.it)<br/>
|
26
29
|
michael@grosser.it<br/>
|
27
|
-
Hereby placed under public domain, do what you want, just do not hold me accountable
|
30
|
+
Hereby placed under public domain, do what you want, just do not hold me accountable...<br/>
|
31
|
+
[](http://travis-ci.org/grosser/sort_alphabetical)
|
32
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/sort_alphabetical.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# TODO do something like with_utf8 do ...
|
2
|
-
|
2
|
+
|
3
|
+
if RUBY_VERSION < "1.9"
|
4
|
+
$KCODE = 'UTF8' # otherwise mb_chars produces normal strings
|
5
|
+
end
|
3
6
|
|
4
7
|
require 'active_support/version'
|
5
8
|
if ActiveSupport::VERSION::MAJOR > 2
|
@@ -26,7 +29,7 @@ module SortAlphabetical
|
|
26
29
|
end
|
27
30
|
|
28
31
|
def to_ascii(string)
|
29
|
-
split_codepoints(string).
|
32
|
+
split_codepoints(string).reject{|e| e.bytes.to_a.length > 1}.join
|
30
33
|
end
|
31
34
|
|
32
35
|
private
|
data/sort_alphabetical.gemspec
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sort_alphabetical}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-10-24}
|
13
13
|
s.email = %q{michael@grosser.it}
|
14
14
|
s.files = [
|
15
|
+
".travis.yml",
|
15
16
|
"Gemfile",
|
16
17
|
"Gemfile.lock",
|
17
18
|
"Rakefile",
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
2
3
|
|
3
4
|
describe "SortAlphabetical"do
|
4
5
|
it "sorts ascii correctly" do
|
@@ -22,6 +23,10 @@ describe "SortAlphabetical"do
|
|
22
23
|
%w(asb aßc asd).sort_alphabetical.should == %w(asb aßc asd)
|
23
24
|
end
|
24
25
|
|
26
|
+
it "sorts ˇ" do
|
27
|
+
["ˇ"].sort_alphabetical.should == ["ˇ"]
|
28
|
+
end
|
29
|
+
|
25
30
|
describe :to_ascii do
|
26
31
|
it "removes any accents" do
|
27
32
|
SortAlphabetical.to_ascii('á').should == 'a'
|
@@ -35,4 +40,4 @@ describe "SortAlphabetical"do
|
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
38
|
-
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sort_alphabetical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-24 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
22
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
24
|
none: false
|
24
25
|
requirements:
|
@@ -28,7 +29,6 @@ dependencies:
|
|
28
29
|
segments:
|
29
30
|
- 0
|
30
31
|
version: "0"
|
31
|
-
type: :runtime
|
32
32
|
name: activesupport
|
33
33
|
version_requirements: *id001
|
34
34
|
prerelease: false
|
@@ -41,6 +41,7 @@ extensions: []
|
|
41
41
|
extra_rdoc_files: []
|
42
42
|
|
43
43
|
files:
|
44
|
+
- .travis.yml
|
44
45
|
- Gemfile
|
45
46
|
- Gemfile.lock
|
46
47
|
- Rakefile
|