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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2dfd714b89645e2d4fc0026d19e90f0281422d61
4
- data.tar.gz: 3164c7c67926ff12f6cc1231cb38195000f14da1
2
+ SHA256:
3
+ metadata.gz: c65073bdbc533210318de532342d680a5bcf1005e02133df2a06deb9541eeb93
4
+ data.tar.gz: e80ef3969d51b113b88e2d880ecc85c35fbe960876dd61747f28a3ed8825f3da
5
5
  SHA512:
6
- metadata.gz: ecfff960d299ddae782abd505017044ee7d3bcbcf3ca34bc4538b2412ef5632b84d72dfc99f98e9adaa906798cfb78254521e4813e7c6ab04e56eb916852eea4
7
- data.tar.gz: e996ca5915e77c65a77e063bc7459663a0d9e69e8f52eb105d2413f8de350896deded52e8b73c43d41352984c9a568f65cb9e7f7be4452b054840a18094c1be9
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 NatualSort
76
+ using NaturalSort
77
77
 
78
- list.natural_sort # => ["a", "a0", "a1", "a1a"...
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
  ```
@@ -2,7 +2,9 @@ module NaturalSort
2
2
  class Segment
3
3
  include Comparable
4
4
 
5
- NUMERIC = /\A\d+(?:\.\d+)?\z/
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
@@ -2,7 +2,7 @@ module NaturalSort
2
2
  class SegmentedString
3
3
  include Comparable
4
4
 
5
- TOKENIZER = /\d+(?:\.\d+)?|\D/
5
+ TOKENIZER = /\d+|\D/
6
6
  private_constant :TOKENIZER
7
7
 
8
8
  attr_reader :input
@@ -1,3 +1,3 @@
1
1
  module NaturalSort
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
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.2.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: 2016-11-14 00:00:00.000000000 Z
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.6.7
47
+ rubygems_version: 2.7.7
48
48
  signing_key:
49
49
  specification_version: 4
50
50
  summary: Natural sorting support for Ruby