roqua-support 0.4.2 → 0.4.3

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
  SHA256:
3
- metadata.gz: 774c4b5c612eff02c808d6dac48cc599664c641deb96b97c923a6d293875a5b4
4
- data.tar.gz: 0b2dd8489e5ec1a6216db145f511d7313776efe7ea07db0604f4bb4c7bfeb3e1
3
+ metadata.gz: b8db18c64c16bd00d48c6714aaa75cc5409e8de42c9abddc0b8237394f9a3f1d
4
+ data.tar.gz: fa43ad8fc601f904d5f95f73a40ab2765ae43992dbac3acfb6ce64c8d12cb1d3
5
5
  SHA512:
6
- metadata.gz: d69bb02afb3adb3bdf1dd64a526466d7b24f8f8b068829a8ce9dfafa2930d29de30cff451fec7ff2d91c933e390c27b2addb336124dd257856c3dc6c510d3b56
7
- data.tar.gz: 316fedffd3ede41f162fb6b294b409b446b204e89412d29dd7f6cc7d07af300e6b3eb5abc8471cea6970944aae74b443adfcef4a3a25843d3b82d40ca39d24e9
6
+ metadata.gz: 3f621133cf5e79e53130436f4721e18f956f8ae1f5967a2575fe38958691e3cc9a8f2dcef789eff8677df6ab19193eba8e26b5c54d487ccb432aa2ad023bbc8a
7
+ data.tar.gz: 5e3d01f8bce7532d046ca66157d8cf64f217f220cb5d0df275b5c1156a81cf3f00bdb8710e52d6dbee8355e7fa6b0785eeb5760e9ea76cb416c913f42e034b0e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.4.3
2
+
3
+ * Make sort_by_alphanum sort shorter string first.
4
+
1
5
  ## 0.4.2
2
6
 
3
7
  * Make sort_by_alphanum stable for chunks that parse to the same int like 04 and 4.
data/Gemfile.lock CHANGED
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- roqua-support (0.4.2)
13
+ roqua-support (0.4.3)
14
14
  active_interaction (>= 3.0, < 5.0)
15
15
  activesupport (>= 5.2, < 6.2)
16
16
  appsignal (>= 2.9, < 3.1)
@@ -51,7 +51,7 @@ GEM
51
51
  bundler
52
52
  rake
53
53
  thor (>= 0.14.0)
54
- appsignal (3.0.19)
54
+ appsignal (3.0.20)
55
55
  rack
56
56
  ast (2.4.2)
57
57
  builder (3.2.4)
@@ -33,6 +33,8 @@ module Enumerable
33
33
  ret = \
34
34
  if a_scanner.eos?
35
35
  -1
36
+ elsif b_scanner.eos?
37
+ 1
36
38
  elsif (a_chunk = a_scanner.scan(ALL_NUM))
37
39
  if (b_chunk = b_scanner.scan(ALL_NUM))
38
40
  if a_chunk.to_i != b_chunk.to_i
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module Support
3
- VERSION = '0.4.2'.freeze
3
+ VERSION = '0.4.3'.freeze
4
4
  end
5
5
  end
@@ -11,6 +11,11 @@ describe Enumerable do
11
11
  expect(input.sort_by_alphanum(&:reverse)).to eq ["004some10thing", "004some11thing", "3another"]
12
12
  end
13
13
 
14
+ it 'sorts shorter strings first' do
15
+ input = %w[a_2_ a_2 a a_1] # curlies are above alpha in utf-8, Ԙ is multi-byte
16
+ expect(input.sort_by_alphanum).to eq %w[a a_1 a_2 a_2_]
17
+ end
18
+
14
19
  it 'treats non-alphanum as lower than alpha and num' do
15
20
  input = %w[b3a b{c bԘb] # curlies are above alpha in utf-8, Ԙ is multi-byte
16
21
  expect(input.sort_by_alphanum).to eq %w[b{c bԘb b3a]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_interaction