naturalsorter 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/naturalsorter/version.rb +1 -1
- data/lib/versioncmp.rb +10 -2
- data/spec/versioncmp_spec.rb +4 -0
- metadata +4 -4
data/lib/versioncmp.rb
CHANGED
@@ -58,6 +58,14 @@ class Versioncmp
|
|
58
58
|
return result if (result != 0)
|
59
59
|
next
|
60
60
|
else
|
61
|
+
# --- START ---- special case for awesome jquery shitty verison numbers
|
62
|
+
if ( part1.match(/^[0-9]+[a-zA-Z]+[0-9]+$/) != nil && part2.match(/^[0-9]+$/) != nil )
|
63
|
+
return -1
|
64
|
+
end
|
65
|
+
if ( part2.match(/^[0-9]+[a-zA-Z]+[0-9]+$/) != nil && part1.match(/^[0-9]+$/) != nil )
|
66
|
+
return 1
|
67
|
+
end
|
68
|
+
# --- END ---- special case for awesome jquery shitty verison numbers
|
61
69
|
return 1 if (part1.match(/^[0-9]+$/) != nil && part2.match(/^[0-9]+$/) == nil)
|
62
70
|
return -1;
|
63
71
|
end
|
@@ -145,8 +153,8 @@ class Versioncmp
|
|
145
153
|
for z in 0..100
|
146
154
|
offsetz = offset + z
|
147
155
|
break if offsetz > cake.length()
|
148
|
-
p = cake[offset..offset + z]
|
149
|
-
if ( p.match(
|
156
|
+
p = cake[ offset..offset + z ]
|
157
|
+
if ( p.match(/^\w+\.$/) != nil )
|
150
158
|
break
|
151
159
|
end
|
152
160
|
end
|
data/spec/versioncmp_spec.rb
CHANGED
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.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70294219997440 !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: *
|
24
|
+
version_requirements: *70294219997440
|
25
25
|
description: This GEM is sorting Arrays in a natural order. a2 < a10
|
26
26
|
email:
|
27
27
|
- robert.reiz@gmx.com
|