sorted_set-nosetdep 1.0.666
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 +7 -0
- data/.github/workflows/test.yml +29 -0
- data/.gitignore +9 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +24 -0
- data/README.md +58 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/sorted_set.rb +57 -0
- data/sorted_set-nosetdep.gemspec +31 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 808f7ae003bc42cfd4c183a68d547f2c82154870a158c848ebd75925bca42849
|
4
|
+
data.tar.gz: 5ca4b83aa4b9920722e09eb9b8df8f57b473b2252386493b41cade899c3cc5e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 85a88bae2602ace908b4085c952e817b53a87e304323bfbbc9f510f71cf1f62e7a9c339ce0bfd18997a76171b03578c5219c55ce87aebf4be16fabce36554db5
|
7
|
+
data.tar.gz: 60265020856f1779a78f9f7708b4cc7dd2eca4c83cd949720d1db53b686f2171c53b7a2c43ca91951fc9a6669f7e2abec7256508241d94de2d7d2e143509b831
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
strategy:
|
8
|
+
fail-fast: false
|
9
|
+
matrix:
|
10
|
+
ruby: [ 2.7, 3.0, head, jruby ]
|
11
|
+
os: [ ubuntu ]
|
12
|
+
|
13
|
+
name: >-
|
14
|
+
${{matrix.os}}-ruby-${{matrix.ruby}}
|
15
|
+
runs-on: ${{matrix.os}}-latest
|
16
|
+
continue-on-error: ${{matrix.ruby == 'head'}}
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- name: Check out
|
20
|
+
uses: actions/checkout@master
|
21
|
+
|
22
|
+
- name: Set up ruby and bundle
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{matrix.ruby}}
|
26
|
+
bundler-cache: true
|
27
|
+
|
28
|
+
- name: Run test
|
29
|
+
run: bundle exec rake test
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# SortedSet Changelog
|
2
|
+
|
3
|
+
## 1.0.666 (2023-05-16)
|
4
|
+
|
5
|
+
* Breaking Changes
|
6
|
+
* Removed "set" explicit dependency; this prevents conflicts with modern Ruby versions, which ship such gem in the stdlib
|
7
|
+
* Bumped minimum Ruby version to 3.0
|
8
|
+
|
9
|
+
## 1.0.3 (2021-02-13)
|
10
|
+
|
11
|
+
* Enhancements
|
12
|
+
* Switch back to the original [rbtree](https://rubygems.org/gems/rbtree) gem, which added support for Ruby >=3.0.
|
13
|
+
|
14
|
+
## 1.0.2 (2020-12-24)
|
15
|
+
|
16
|
+
* Enhancements
|
17
|
+
* Switch to the [rbtree3](https://github.com/kyrylo/rbtree3) gem to support Ruby >=3.0.
|
18
|
+
|
19
|
+
## 1.0.1 (2020-12-22)
|
20
|
+
|
21
|
+
* Enhancements
|
22
|
+
* Be a no-op library for JRuby, as it has its own version of Set and SortedSet.
|
23
|
+
|
24
|
+
## 1.0.0 (2020-12-22)
|
25
|
+
|
26
|
+
This is the first release of sorted_set as a gem. Here lists the changes since the version bundled with Ruby 2.7.
|
27
|
+
|
28
|
+
* Breaking Changes
|
29
|
+
* The pure-ruby fallback implementation has been removed. It now requires an RBTree library to install and run.
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2002-2020 Akinori MUSHA
|
2
|
+
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions
|
7
|
+
are met:
|
8
|
+
1. Redistributions of source code must retain the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
12
|
+
documentation and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
17
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
18
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
20
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
21
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
22
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
23
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# SortedSet
|
2
|
+
|
3
|
+
SortedSet implements a Set whose elements are sorted in ascending
|
4
|
+
order (according to the return values of their `<=>` methods) when
|
5
|
+
iterating over them.
|
6
|
+
|
7
|
+
Every element in SortedSet must be *mutually comparable* to every
|
8
|
+
other: comparison with `<=>` must not return nil for any pair of
|
9
|
+
elements. Otherwise ArgumentError will be raised.
|
10
|
+
|
11
|
+
Currently this library does nothing for JRuby, as it has its own
|
12
|
+
version of Set and SortedSet.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'sorted_set'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle install
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install sorted_set
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require "sorted_set"
|
34
|
+
|
35
|
+
set = SortedSet.new([2, 1, 5, 6, 4, 5, 3, 3, 3])
|
36
|
+
ary = []
|
37
|
+
|
38
|
+
set.each do |obj|
|
39
|
+
ary << obj
|
40
|
+
end
|
41
|
+
|
42
|
+
p ary # => [1, 2, 3, 4, 5, 6]
|
43
|
+
|
44
|
+
set2 = SortedSet.new([1, 2, "3"])
|
45
|
+
set2.each { |obj| } # => raises ArgumentError: comparison of Fixnum with String failed
|
46
|
+
```
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/knu/sorted_set.
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
The gem is available as open source under either the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sorted_set"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/sorted_set.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# :markup: markdown
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
return if defined?(JRUBY_VERSION)
|
6
|
+
|
7
|
+
require 'rbtree'
|
8
|
+
|
9
|
+
Object.instance_exec do
|
10
|
+
# Undefine SortedSet for two reasons.
|
11
|
+
#
|
12
|
+
# 1. We should wipe out an existing implementation if Ruby 2.x loads
|
13
|
+
# this library after loading the standard set library which
|
14
|
+
# defines SortedSet.
|
15
|
+
#
|
16
|
+
# 2. Ruby >=3.0 (set >=1.0.0) sets autoload on SortedSet, and we
|
17
|
+
# shouldn't let the following reference to SortedSet fire it
|
18
|
+
# because it would end up requiring this library, leading to
|
19
|
+
# circular require.
|
20
|
+
#
|
21
|
+
remove_const :SortedSet if const_defined?(:SortedSet)
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# SortedSet implements a Set whose elements are sorted in ascending
|
26
|
+
# order (according to the return values of their `<=>` methods) when
|
27
|
+
# iterating over them.
|
28
|
+
#
|
29
|
+
# Every element in SortedSet must be *mutually comparable* to every
|
30
|
+
# other: comparison with `<=>` must not return nil for any pair of
|
31
|
+
# elements. Otherwise ArgumentError will be raised.
|
32
|
+
#
|
33
|
+
# ## Example
|
34
|
+
#
|
35
|
+
# ```ruby
|
36
|
+
# require "sorted_set"
|
37
|
+
#
|
38
|
+
# set = SortedSet.new([2, 1, 5, 6, 4, 5, 3, 3, 3])
|
39
|
+
# ary = []
|
40
|
+
#
|
41
|
+
# set.each do |obj|
|
42
|
+
# ary << obj
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# p ary # => [1, 2, 3, 4, 5, 6]
|
46
|
+
#
|
47
|
+
# set2 = SortedSet.new([1, 2, "3"])
|
48
|
+
# set2.each { |obj| } # => raises ArgumentError: comparison of Fixnum with String failed
|
49
|
+
# ```
|
50
|
+
|
51
|
+
class SortedSet < Set
|
52
|
+
# Creates a SortedSet. See Set.new for details.
|
53
|
+
def initialize(*args)
|
54
|
+
@hash = RBTree.new
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "sorted_set-nosetdep"
|
3
|
+
spec.version = "1.0.666"
|
4
|
+
spec.authors = ["Saverio Miroddi"]
|
5
|
+
spec.email = ["saverio.pub2@gmail.com"]
|
6
|
+
|
7
|
+
spec.summary = %q{Fork of "sorted_set", without explicit "set" gem dependency}
|
8
|
+
spec.description = %q{Fork of "sorted_set", without explicit "set" gem dependency}
|
9
|
+
spec.homepage = "https://github.com/ticketsolve/sorted_set-nosetdep"
|
10
|
+
spec.license = "BSD-2-Clause"
|
11
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
12
|
+
|
13
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
14
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
15
|
+
spec.metadata["changelog_uri"] = "https://github.com/ticketsolve/sorted_set-nosetdep/blob/v#{spec.version}/CHANGELOG.md"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
if defined?(JRUBY_VERSION)
|
27
|
+
spec.platform = "java"
|
28
|
+
else
|
29
|
+
spec.add_runtime_dependency "rbtree"
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sorted_set-nosetdep
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.666
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Saverio Miroddi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rbtree
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Fork of "sorted_set", without explicit "set" gem dependency
|
28
|
+
email:
|
29
|
+
- saverio.pub2@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".github/workflows/test.yml"
|
35
|
+
- ".gitignore"
|
36
|
+
- CHANGELOG.md
|
37
|
+
- Gemfile
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- bin/console
|
42
|
+
- bin/setup
|
43
|
+
- lib/sorted_set.rb
|
44
|
+
- sorted_set-nosetdep.gemspec
|
45
|
+
homepage: https://github.com/ticketsolve/sorted_set-nosetdep
|
46
|
+
licenses:
|
47
|
+
- BSD-2-Clause
|
48
|
+
metadata:
|
49
|
+
homepage_uri: https://github.com/ticketsolve/sorted_set-nosetdep
|
50
|
+
source_code_uri: https://github.com/ticketsolve/sorted_set-nosetdep
|
51
|
+
changelog_uri: https://github.com/ticketsolve/sorted_set-nosetdep/blob/v1.0.666/CHANGELOG.md
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.0.0
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubygems_version: 3.4.12
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Fork of "sorted_set", without explicit "set" gem dependency
|
71
|
+
test_files: []
|