natural_sort 0.2.0 → 0.3.0
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.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/lib/natural_sort/segment.rb +3 -1
- data/lib/natural_sort/segmented_string.rb +1 -1
- data/lib/natural_sort/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c65073bdbc533210318de532342d680a5bcf1005e02133df2a06deb9541eeb93
|
4
|
+
data.tar.gz: e80ef3969d51b113b88e2d880ecc85c35fbe960876dd61747f28a3ed8825f3da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 942436f6dd57b0234880b9e719c9803ff4c4d8a4f7e7f0419297775d27fe2c2adcaa9b059d3eb9c0ec567865bf7d2a96bdcedc28bb07d2feaf321f8d52d3b1eb
|
7
|
+
data.tar.gz: 506dda46929bfcc7682844f21aef3d051ae53c1f797711986405aa4b8605618aa6d553843defda251699b07eecba7b43f0f6b9f72d30a57660bf311071211ad2
|
data/README.md
CHANGED
@@ -73,9 +73,9 @@ If you're running ruby 2.1 or newer, you can use refinements.
|
|
73
73
|
require "natural_sort/refinments"
|
74
74
|
|
75
75
|
class MyClass
|
76
|
-
using
|
76
|
+
using NaturalSort
|
77
77
|
|
78
|
-
list.natural_sort
|
78
|
+
list.natural_sort # => ["a", "a0", "a1", "a1a"...
|
79
79
|
ubuntu_releases.natural_sort_by(&:number) # => [ UbuntuRelease.new("8.10"...
|
80
80
|
end
|
81
81
|
```
|
data/lib/natural_sort/segment.rb
CHANGED
@@ -2,7 +2,9 @@ module NaturalSort
|
|
2
2
|
class Segment
|
3
3
|
include Comparable
|
4
4
|
|
5
|
-
|
5
|
+
# Segments that look like numbers, but start with 0 should be treated as
|
6
|
+
# strings, so that we don't asumme that 1.020 is more than 1.1 cause 20 > 1
|
7
|
+
NUMERIC = /\A[1-9]\d*\z/
|
6
8
|
private_constant :NUMERIC
|
7
9
|
|
8
10
|
attr_reader :input
|
data/lib/natural_sort/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: natural_sort
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pravosud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -44,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
46
|
rubyforge_project:
|
47
|
-
rubygems_version: 2.
|
47
|
+
rubygems_version: 2.7.7
|
48
48
|
signing_key:
|
49
49
|
specification_version: 4
|
50
50
|
summary: Natural sorting support for Ruby
|