naturally 2.0.0 → 2.1.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
2
  SHA1:
3
- metadata.gz: 4e92f4d1a615260c308166aeb8e444042a8fcac4
4
- data.tar.gz: fce65d08b22e07b490ad58f11bfa08e0ccaad5dc
3
+ metadata.gz: 3c7fe0629f54a4f0418f2ef7bd0b698bac3ed282
4
+ data.tar.gz: 87063a64049efd21df9051ebf72b18cc4142e0b1
5
5
  SHA512:
6
- metadata.gz: 9480f5bd22d47fd903b7714fd0cccf5b1f3e97a2dae758aefa770beaa557deba41b5af49491357f3f5a19de09e11a88a344988afad9276c73a6e51649ddfc84b
7
- data.tar.gz: b71f7d4376eb1baced1dd2c7e027b7f25dec3aa62379878ddb8ddba15a4d8a761b43f0f687948a2b30ae3b86b1e1568bf1c49d17fd1ec51710fc75f5b9dad922
6
+ metadata.gz: 6b5485915f455c893d8fc1fd0afd1116c602447e863a54cf8704fe42fb21269f71834d80369ed701389483d063293592b2b342226a608cea0804eda3298b6090
7
+ data.tar.gz: ff836d19c5b40dc8a79ae0f6e638dd3272ae51026b2ee3fe1dd7ee8a07e1e1d9ef9a4880a3b724ed193a92aa36d9816f12963c56b2c3c5cff26c0cbcf311d9c5
@@ -37,7 +37,7 @@ module Naturally
37
37
  # @return [Array<Segment>] an array of Segments which
38
38
  # can be sorted naturally via a standard #sort.
39
39
  def self.normalize(complex_number)
40
- tokens = complex_number.to_s.scan(/\p{Word}+/)
40
+ tokens = complex_number.to_s.gsub(/\_/,'').scan(/\p{Word}+/)
41
41
  tokens.map { |t| Segment.new(t) }
42
42
  end
43
43
 
@@ -1,4 +1,4 @@
1
1
  module Naturally
2
2
  # Gem version
3
- VERSION = '2.0.0'
3
+ VERSION = '2.1.0'
4
4
  end
@@ -66,6 +66,13 @@ describe Naturally do
66
66
  )
67
67
  end
68
68
 
69
+ it 'sorts strings suffixed with underscore and numbers correctly' do
70
+ it_sorts(
71
+ this: %w(item_10 item_11 item_1 item_7 item_5 item_3 item_4 item_6 item_2),
72
+ to_this: %w(item_1 item_2 item_3 item_4 item_5 item_6 item_7 item_10 item_11)
73
+ )
74
+ end
75
+
69
76
  it 'sorts letters with digits correctly' do
70
77
  it_sorts(
71
78
  this: %w(1 a 2 b 3 c),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naturally
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter