naturalsort 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +49 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +130 -0
- data/Rakefile +7 -24
- data/lib/natural_sort.rb +4 -102
- data/lib/natural_sort/base.rb +68 -0
- data/lib/natural_sort/engine.rb +85 -0
- data/lib/natural_sort/kernel.rb +64 -0
- data/lib/natural_sort/version.rb +5 -0
- data/lib/natural_sort_kernel.rb +2 -46
- data/naturalsort.gemspec +22 -0
- data/test/test_helper.rb +36 -29
- data/test/test_natural_sort.rb +13 -13
- data/test/test_natural_sort_alone.rb +11 -3
- data/test/test_natural_sort_kernel.rb +21 -20
- metadata +72 -97
- data/History.txt +0 -24
- data/Manifest.txt +0 -10
- data/README.txt +0 -87
metadata
CHANGED
@@ -1,121 +1,96 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: naturalsort
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 1
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
version: 1.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Benjamin Francisoud
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 2
|
29
|
-
- 0
|
30
|
-
- 4
|
31
|
-
version: 2.0.4
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
32
20
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: hoe
|
36
21
|
prerelease: false
|
37
|
-
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
46
34
|
type: :development
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
* sort case insensitive
|
59
|
-
* sort filename matching pattern "abc1", "abc12", "abc2" in the correct order
|
60
|
-
* sort filename matching pattern "a1b2"
|
61
|
-
* sort underscore insensitive
|
62
|
-
|
63
|
-
== Install:
|
64
|
-
|
65
|
-
* sudo gem install naturalsort
|
66
|
-
email: pub.cog@gmail.com
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: ! 'Example: %w(1 2a A1 a11 A12 a2 a21 x__2 X_1).natural_sort => %w(1
|
42
|
+
2a A1 a11 A12 a2 a21 x__2 X_1)'
|
43
|
+
email:
|
44
|
+
- pub.cog@gmail.com
|
67
45
|
executables: []
|
68
|
-
|
69
46
|
extensions: []
|
70
|
-
|
71
|
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
- README.txt
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- .travis.yml
|
51
|
+
- CHANGELOG.md
|
52
|
+
- Gemfile
|
53
|
+
- LICENSE
|
54
|
+
- README.md
|
79
55
|
- Rakefile
|
80
56
|
- lib/natural_sort.rb
|
57
|
+
- lib/natural_sort/base.rb
|
58
|
+
- lib/natural_sort/engine.rb
|
59
|
+
- lib/natural_sort/kernel.rb
|
60
|
+
- lib/natural_sort/version.rb
|
81
61
|
- lib/natural_sort_kernel.rb
|
62
|
+
- naturalsort.gemspec
|
82
63
|
- test/test_helper.rb
|
83
64
|
- test/test_natural_sort.rb
|
84
65
|
- test/test_natural_sort_alone.rb
|
85
66
|
- test/test_natural_sort_kernel.rb
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
67
|
+
homepage: http://rubyforge.org/projects/naturalsort/
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
90
71
|
post_install_message:
|
91
|
-
rdoc_options:
|
92
|
-
|
93
|
-
- README.txt
|
94
|
-
require_paths:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
95
74
|
- lib
|
96
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
segments:
|
108
|
-
- 0
|
109
|
-
version: "0"
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
110
85
|
requirements: []
|
111
|
-
|
112
|
-
|
113
|
-
rubygems_version: 1.3.6
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.4.5
|
114
88
|
signing_key:
|
115
|
-
specification_version:
|
116
|
-
summary: NaturalSort is a
|
117
|
-
|
118
|
-
|
89
|
+
specification_version: 4
|
90
|
+
summary: NaturalSort is a simple library which implements a natural, human-friendly
|
91
|
+
alphanumeric sort in Ruby
|
92
|
+
test_files:
|
119
93
|
- test/test_helper.rb
|
120
|
-
- test/test_natural_sort_kernel.rb
|
121
94
|
- test/test_natural_sort.rb
|
95
|
+
- test/test_natural_sort_alone.rb
|
96
|
+
- test/test_natural_sort_kernel.rb
|
data/History.txt
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
== 1.1.1 / 2010-07-21
|
2
|
-
* Fix typo error in some unit test
|
3
|
-
* Remove copy/paste between naturalsort and natural_sort methods
|
4
|
-
* Added samples in rdoc
|
5
|
-
* Adding contribution from Sobe http://pastie.caboo.se/139803 (thanks mate)
|
6
|
-
* Sort complex text list (see test_natural_sort_kernel.rb:107))
|
7
|
-
* Fix more complex [string][number] pattern like:
|
8
|
-
* ["x2-y08", "x2-g8", "x2-y7", "x8-y8"].natural_sort => ["x2-g8", "x2-y7", "x2-y08", "x8-y8"]
|
9
|
-
* ["x02-y08", "x02-g8", "x2-y7", "x8-y8"].natural_sort => ["x02-g8", "x2-y7", "x02-y08", "x8-y8"]
|
10
|
-
* Fix bug in Range ordering:
|
11
|
-
* (1..21).natural_sort => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
|
12
|
-
|
13
|
-
== 1.1.0 / 2008-01-08
|
14
|
-
* Improve documentation to get better google results
|
15
|
-
* Remove alias methods: <tt>sort_natural, sort_alpha, alpha_sort, sort_alphabetical, alphabetical_sort, sort_alphanum, alphanum_sort</tt>
|
16
|
-
|
17
|
-
== 1.0.1 / 2007-12-18
|
18
|
-
|
19
|
-
* Fix problem using as a static method
|
20
|
-
* Refactoring code
|
21
|
-
|
22
|
-
== 1.0.0 / 2007-12-14
|
23
|
-
|
24
|
-
* Project creation
|
data/Manifest.txt
DELETED
data/README.txt
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
NaturalSort
|
2
|
-
http://naturalsort.rubyforge.org/
|
3
|
-
|
4
|
-
== Description:
|
5
|
-
|
6
|
-
NaturalSort is a small and simple library to implements a natural or human alphabetical sort in ruby.
|
7
|
-
It's sometimes call:
|
8
|
-
* natural sort
|
9
|
-
* alpha sort
|
10
|
-
* alphabetical sort
|
11
|
-
* alphanum sort
|
12
|
-
|
13
|
-
Examples:
|
14
|
-
['a1', 'a11', 'a12', 'a2', 'a21'] => ['a1', 'a2', 'a11', 'a12','a21']
|
15
|
-
['a', 'b', 'c', 'A', 'B', 'C'] => ['A', 'a', 'B', 'b', 'C', 'c']
|
16
|
-
['x__2', 'x_1'] => ['x_1', 'x__2']
|
17
|
-
['x2-y08', 'x2-g8', 'x2-y7', 'x8-y8'] => ['x2-g8', 'x2-y7', 'x2-y08', 'x8-y8']
|
18
|
-
* ['x02-y08', 'x02-g8', 'x2-y7', 'x8-y8'] => ['x02-g8', 'x2-y7', 'x02-y08', 'x8-y8']
|
19
|
-
|
20
|
-
== Features:
|
21
|
-
|
22
|
-
* sort case insensitive
|
23
|
-
* sort filename matching pattern "abc1", "abc12", "abc2" in the correct order
|
24
|
-
* sort filename matching pattern "a1b2"
|
25
|
-
* sort underscore insensitive
|
26
|
-
|
27
|
-
== Install:
|
28
|
-
|
29
|
-
* sudo gem install naturalsort
|
30
|
-
|
31
|
-
== Synopsis:
|
32
|
-
|
33
|
-
=== Usage N�1 - Add to your ruby default objects
|
34
|
-
Add natural sort methods to ruby default object (Array, Hash, etc...)
|
35
|
-
|
36
|
-
require 'natural_sort_kernel'
|
37
|
-
|
38
|
-
sorted = ['a', 'b', 'c', 'd', 'A', 'B', 'C', 'D'].natural_sort
|
39
|
-
...
|
40
|
-
|
41
|
-
=== Usage N�2 - Use only one method
|
42
|
-
|
43
|
-
require 'natural_sort'
|
44
|
-
|
45
|
-
sorted = NaturalSort::naturalsort ['a', 'b', 'c', 'd', 'A', 'B', 'C', 'D']
|
46
|
-
|
47
|
-
== About
|
48
|
-
|
49
|
-
* Rubyforge project page http://rubyforge.org/projects/naturalsort
|
50
|
-
* Author: Benjamin Francisoud http://www.google.com/profiles/benjamin.francisoud
|
51
|
-
|
52
|
-
== Related Links
|
53
|
-
|
54
|
-
Links related to the alphabetical sorting problem:
|
55
|
-
* http://www.codinghorror.com/blog/archives/001018.html
|
56
|
-
* http://sourcefrog.net/projects/natsort/
|
57
|
-
* http://be2.php.net/natsort
|
58
|
-
* http://www.wellho.net/forum/Programming-in-Python-and-Ruby/Python-Sort-Order.html
|
59
|
-
* http://www.davekoelle.com/alphanum.html
|
60
|
-
* http://rikkus.info/arch/sensible_sort.rb
|
61
|
-
* http://weblog.masukomi.org/2007/12/10/alphabetical-asciibetical
|
62
|
-
* http://nedbatchelder.com/blog/200712.html#e20071211T054956
|
63
|
-
|
64
|
-
== License:
|
65
|
-
|
66
|
-
(The MIT License)
|
67
|
-
|
68
|
-
Copyright (c) 2007 Benjamin Francisoud
|
69
|
-
|
70
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
71
|
-
a copy of this software and associated documentation files (the
|
72
|
-
'Software'), to deal in the Software without restriction, including
|
73
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
74
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
75
|
-
permit persons to whom the Software is furnished to do so, subject to
|
76
|
-
the following conditions:
|
77
|
-
|
78
|
-
The above copyright notice and this permission notice shall be
|
79
|
-
included in all copies or substantial portions of the Software.
|
80
|
-
|
81
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
82
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
83
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
84
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
85
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
86
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
87
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|