naturalsorter 0.3.3 → 0.3.4

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.
@@ -1,3 +1,3 @@
1
1
  module Naturalsorter
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/lib/versioncmp.rb CHANGED
@@ -95,7 +95,7 @@ class Versioncmp
95
95
 
96
96
  if ( part2.match(/^[0-9]+[a-zA-Z]+[0-9]+$/) != nil && part1.match(/^[0-9]+$/) != nil )
97
97
  part2_1 = part2.match(/^[0-9]+/)
98
- result = Versioncmp.compareInt(part2_1[0], part1)
98
+ result = Versioncmp.compareInt(part1, part2_1[0])
99
99
  if result != 0
100
100
  return result
101
101
  end
@@ -118,4 +118,12 @@ describe Versioncmp do
118
118
  Versioncmp.compare("1.7", "1.7b").should eql(1)
119
119
  end
120
120
 
121
+ it "1.7.1rc1 is smaller than 1.7.2" do
122
+ Versioncmp.compare("1.7.1rc1", "1.7.2").should eql(-1)
123
+ end
124
+
125
+ it "1.7.2 is bigger than 1.7.1rc1" do
126
+ Versioncmp.compare("1.7.2", "1.7.1rc1").should eql(1)
127
+ end
128
+
121
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naturalsorter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70269390492700 !ruby/object:Gem::Requirement
16
+ requirement: &70353255258340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '2.6'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70269390492700
24
+ version_requirements: *70353255258340
25
25
  description: This GEM is sorting Arrays in a natural order. a2 < a10
26
26
  email:
27
27
  - robert.reiz@gmx.com