naturalsort 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,14 @@
1
+ == 1.1.0 / 2008-01-08
2
+ * Improve documentation to get better google results
3
+ * Remove alias methods:
4
+ ** sort_natural
5
+ ** sort_alpha
6
+ ** alpha_sort
7
+ ** sort_alphabetical
8
+ ** alphabetical_sort
9
+ ** sort_alphanum
10
+ ** alphanum_sort
11
+
1
12
  == 1.0.1 / 2007-12-18
2
13
 
3
14
  * Fix problem using as a static method
data/README.txt CHANGED
@@ -1,10 +1,15 @@
1
1
  NaturalSort
2
- http://rubyforge.org/projects/naturalsort
3
- by Benjamin Francisoud http://benjamin.francisoud.googlepages.com
2
+ by Benjamin Francisoud
3
+ http://benjamin.francisoud.googlepages.com
4
4
 
5
5
  == Description:
6
6
 
7
7
  NaturalSort is a small and simple library to implements a natural or human alphabetical sort in ruby.
8
+ It's sometimes call:
9
+ * natural sort
10
+ * alpha sort
11
+ * alphabetical sort
12
+ * alphanum sort
8
13
 
9
14
  Examples:
10
15
  ['a1', 'a11', 'a12', 'a2', 'a21'] => ['a1', 'a2', 'a11', 'a12','a21']
@@ -17,6 +22,10 @@ Examples:
17
22
  * sort filename matching pattern "abc1", "abc12", "abc2" in the correct order
18
23
  * sort underscore insensitive
19
24
 
25
+ == Install:
26
+
27
+ * sudo gem install naturalsort
28
+
20
29
  == Synopsis:
21
30
 
22
31
  === Usage N�1 - Add to your ruby default objects
@@ -24,12 +33,8 @@ Add natural sort methods to ruby default object (Array, Hash, etc...)
24
33
 
25
34
  require 'natural_sort_kernel'
26
35
 
27
- sorted = ['a', 'b', 'c', 'd', 'A', 'B', 'C', 'D'].alphanum_sort
28
- sorted = ['a', 'b', 'c', 'd', 'A', 'B', 'C', 'D'].alpha_sort
29
36
  sorted = ['a', 'b', 'c', 'd', 'A', 'B', 'C', 'D'].natural_sort
30
- sorted = ['a', 'b', 'c', 'd', 'A', 'B', 'C', 'D'].sort_natural
31
37
  ...
32
- Pick your favorite method name: NaturalSort
33
38
 
34
39
  === Usage N�2 - Use only one method
35
40
 
@@ -37,9 +42,10 @@ Pick your favorite method name: NaturalSort
37
42
 
38
43
  sorted = NaturalSort::naturalsort ['a', 'b', 'c', 'd', 'A', 'B', 'C', 'D']
39
44
 
40
- == Install:
45
+ == About
41
46
 
42
- * sudo gem install naturalsort
47
+ * Rubyforge project page http://rubyforge.org/projects/naturalsort
48
+ * Author: Benjamin Francisoud http://benjamin.francisoud.googlepages.com
43
49
 
44
50
  == Related Links
45
51
 
data/Rakefile CHANGED
@@ -18,13 +18,11 @@ end
18
18
 
19
19
  SVN = 'svn+ssh://cogito@rubyforge.org/var/svn/naturalsort'
20
20
 
21
- # FIXME
22
21
  task :svn_branch => [:clean] do
23
22
  `svn delete #{SVN}/branches/1.X -m "cleanup branch"`
24
23
  `svn copy #{SVN}/trunk #{SVN}/branches/1.X -m "create branch"`
25
24
  end
26
25
 
27
- # FIXME
28
26
  task :svn_tag do
29
27
  `svn copy #{SVN}/trunk #{SVN}/tags/#{NaturalSort::VERSION} -m "create tag"`
30
28
  end
@@ -7,7 +7,7 @@
7
7
  #
8
8
  # ['a', 'b', 'A', 'B'].natural_sort #=> ['A', 'a', 'B', 'b']
9
9
  module NaturalSort
10
- VERSION = '1.0.1'
10
+ VERSION = '1.1.0'
11
11
 
12
12
  # call-seq:
13
13
  # NaturalSort::naturalsort(object) => array
@@ -56,14 +56,6 @@ module NaturalSort
56
56
  end
57
57
  end
58
58
 
59
- alias sort_natural natural_sort
60
- alias sort_alpha natural_sort
61
- alias alpha_sort natural_sort
62
- alias sort_alphabetical natural_sort
63
- alias alphabetical_sort natural_sort
64
- alias sort_alphanum natural_sort
65
- alias alphanum_sort natural_sort
66
-
67
59
  private
68
60
 
69
61
  def self.check_regexp(sa, sb)
@@ -90,4 +82,4 @@ module NaturalSort
90
82
  def format(match_data, length)
91
83
  NaturalSort::format(match_data, length)
92
84
  end
93
- end
85
+ end
@@ -28,14 +28,6 @@ class TestNaturalSort < Test::Unit::TestCase
28
28
  @obj = MyClass.new
29
29
  end
30
30
 
31
- def test_alias
32
- assert_equal BaseSorted, (@obj.sort_natural)
33
- assert_equal BaseSorted, (@obj.sort_alpha)
34
- assert_equal BaseSorted, (@obj.alpha_sort)
35
- assert_equal BaseSorted, (@obj.sort_alphabetical)
36
- assert_equal BaseSorted, (@obj.alphabetical_sort)
37
- end
38
-
39
31
  def test_case_sensitive
40
32
  sorted = @obj.natural_sort
41
33
  assert_equal BaseSorted, sorted
@@ -16,30 +16,28 @@ class TestNaturalSortKernel < Test::Unit::TestCase
16
16
 
17
17
  def test_enum
18
18
  enum = TestEnum.new
19
- assert_equal NaturalSort::BaseSorted, enum.alphanum_sort
19
+ assert_equal NaturalSort::BaseSorted, enum.natural_sort
20
20
  end
21
21
 
22
22
  def test_array
23
- assert_equal NaturalSort::BaseSorted, NaturalSort::Base.alphanum_sort
24
- assert_equal NaturalSort::BaseSorted, NaturalSort::Base.alpha_sort
25
- assert_equal NaturalSort::BaseSorted, NaturalSort::Base.sort_natural
23
+ assert_equal NaturalSort::BaseSorted, NaturalSort::Base.natural_sort
26
24
  end
27
25
 
28
26
  def test_range
29
27
  expected = [1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 3, 4, 5, 6, 7, 8, 9]
30
- assert_equal expected, (1..21).alphanum_sort
28
+ assert_equal expected, (1..21).natural_sort
31
29
  end
32
30
 
33
31
  def test_set
34
32
  set = Set.new NaturalSort::Base
35
- assert_equal NaturalSort::BaseSorted, set.alphanum_sort
33
+ assert_equal NaturalSort::BaseSorted, set.natural_sort
36
34
  end
37
35
 
38
36
  def test_hash
39
37
  expected = [["A", "value"], ["a", "value"], ["B", "value"], ["b", "value"],
40
38
  ["C", "value"], ["c", "value"], ["D", "value"], ["d", "value"]]
41
39
  hash = { "a" => "value", "b" => "value", "c" => "value", "d" => "value", "A" => "value", "B" => "value", "C" => "value", "D" => "value" }
42
- assert_equal expected, hash.alphanum_sort
40
+ assert_equal expected, hash.natural_sort
43
41
  end
44
42
 
45
43
  def test_identical_simple
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: naturalsort
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2007-12-18 00:00:00 +01:00
6
+ version: 1.1.0
7
+ date: 2008-01-08 00:00:00 +01:00
8
8
  summary: NaturalSort is a small and simple library to implements a natural or human friendly alphabetical sort in ruby.
9
9
  require_paths:
10
10
  - lib
11
11
  email: pub.cog@gmail.com
12
- homepage: " http://rubyforge.org/projects/naturalsort"
12
+ homepage: " by Benjamin Francisoud"
13
13
  rubyforge_project: naturalsort
14
- description: "Examples: ['a1', 'a11', 'a12', 'a2', 'a21'] => ['a1', 'a2', 'a11', 'a12','a21'] ['a', 'b', 'c', 'A', 'B', 'C'] => ['A', 'a', 'B', 'b', 'C', 'c'] ['x__2', 'x_1'] => ['x_1', 'x__2'] == Features: * sort case insensitive * sort filename matching pattern \"abc1\", \"abc12\", \"abc2\" in the correct order * sort underscore insensitive == Synopsis: === Usage N\xB01 - Add to your ruby default objects Add natural sort methods to ruby default object (Array, Hash, etc...)"
14
+ description: "Examples: ['a1', 'a11', 'a12', 'a2', 'a21'] => ['a1', 'a2', 'a11', 'a12','a21'] ['a', 'b', 'c', 'A', 'B', 'C'] => ['A', 'a', 'B', 'b', 'C', 'c'] ['x__2', 'x_1'] => ['x_1', 'x__2'] == Features: * sort case insensitive * sort filename matching pattern \"abc1\", \"abc12\", \"abc2\" in the correct order * sort underscore insensitive == Install: * sudo gem install naturalsort"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin