sorted_containers 1.0.0 → 1.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
  SHA256:
3
- metadata.gz: 3402cc1b71fc79ef75e11c571123f82a2e79063688413922f8635dffaed9e179
4
- data.tar.gz: 7a07b07ca3062d60cf0a92a60e1b3299629aa3d2ae3aaac46d81e8f9f8118d18
3
+ metadata.gz: 79ae63c0d79d80ddc1ae621638b598673c2aca5732277582dedcf58c58be89c4
4
+ data.tar.gz: d6b9be454ce395905449ec323a115e89a9319237dc62a96b70568e061a7a6906
5
5
  SHA512:
6
- metadata.gz: 441f144945782fa0100b2814ad0282efce28d948058b1e5219a24674b1c05591e8adf93642f3ad1fa4c5d31d12e7961102219c52943507b37aae2c827d8488fd
7
- data.tar.gz: 97021f40b0c465854c087772739d731d32dc22029f2387532c8878f681327f7403c61505a844bab3b6acc2a698947dca3cb3bc185116a611341375a4154d8f8b
6
+ metadata.gz: 4faf2986fae2b98c40f8bc58797b437e023c342504bbe0fdcc364b0dd922708030b63bfb979e256794b6f9b9c345d0b0eafb5835561e21b1c1076ef28893a500
7
+ data.tar.gz: a80d3cbfe66ca19bf137b835684d4162c9ac665641fe70e6e1a2ce1c86a825ad69f0180e48aa65a642b016f133cb9c922aa6e9d5c9da2b8c3c5123646b8948b5
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- ## [Unreleased]
1
+ ## [1.1.0] - 2024-10-25
2
+
3
+ - Fix `SortedArray#bsearch_index` to work with comparable operator `<=>`
4
+ - Fix bug where deleting elements can cause array to become corrupted
2
5
 
3
6
  ## [0.1.1] - 2024-04-25
4
7
 
data/README.md CHANGED
@@ -4,7 +4,17 @@
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/sorted_containers.svg)](https://badge.fury.io/rb/sorted_containers)
6
6
 
7
- SortedContainers is a fast implementation of sorted arrays, sets, and hashes in pure Ruby. It is based on the [sortedcontainers](https://grantjenks.com/docs/sortedcontainers/) Python library by Grant Jenks.
7
+ SortedContainers is a fast implementation of sorted arrays, sets, and hashes in pure Ruby.
8
+
9
+ - SortedArray, SortedSet, and SortedHash
10
+ - Pure Ruby
11
+ - Fast Performance
12
+ - (almost) Identical API to Array, Set, and Hash
13
+ - No dependencies
14
+ - Benchmarks
15
+ - Unit Tested
16
+
17
+ This library is based on the [sortedcontainers](https://grantjenks.com/docs/sortedcontainers/) Python library by Grant Jenks.
8
18
 
9
19
  SortedContainers provides three main classes: `SortedArray`, `SortedSet`, and `SortedHash`. Each class is a drop-in replacement for the corresponding Ruby class, but with the added benefit of maintaining the elements in sorted order.
10
20
 
@@ -355,9 +355,7 @@ module SortedContainers
355
355
  def bsearch_index(&block)
356
356
  return nil if @maxes.empty?
357
357
 
358
- pos = @maxes.bsearch_index(&block)
359
-
360
- return nil if pos.nil?
358
+ pos = @maxes.bsearch_index(&block) || 0
361
359
 
362
360
  idx = @lists[pos].bsearch_index(&block)
363
361
  loc(pos, idx)
@@ -1384,7 +1382,7 @@ module SortedContainers
1384
1382
  pos += 1 if pos.zero?
1385
1383
 
1386
1384
  prev = pos - 1
1387
- @lists[prev].concat(list)
1385
+ @lists[prev].concat(@lists[pos])
1388
1386
  @maxes[prev] = @lists[prev].last
1389
1387
 
1390
1388
  @lists.delete_at(pos)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SortedContainers
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorted_containers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garrison Jensen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-30 00:00:00.000000000 Z
11
+ date: 2024-10-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A collection of sorted containers including SortedArray, SortedDict,
14
14
  and SortedSet.
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.5.10
59
+ rubygems_version: 3.5.16
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: A collection of sorted containers including SortedArray, SortedDict, and