persistent-dmnd 2.0.2 → 2.0.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 +4 -4
- data/.gitlab-ci.yml +54 -18
- data/.ruby-version +1 -1
- data/CODE_OF_CONDUCT.adoc +1 -1
- data/LICENSE +1 -1
- data/README.adoc +1 -1
- data/gems.rb +2 -2
- data/lib/persistent-dmnd.rb +3 -3
- data/lib/persistent-/360/237/222/216.rb +8 -8
- data/lib/persistent_dmnd/array.rb +8 -8
- data/lib/persistent_dmnd/concurrent_ruby_support.rb +5 -5
- data/lib/persistent_dmnd/dmndifier.rb +4 -4
- data/lib/persistent_dmnd/everywhere.rb +4 -5
- data/lib/persistent_dmnd/hash.rb +8 -8
- data/lib/persistent_dmnd/is_persistent.rb +2 -2
- data/lib/persistent_dmnd/jruby_9_2_set_workaround.rb +8 -10
- data/lib/persistent_dmnd/jruby_workaround.rb +11 -11
- data/lib/persistent_dmnd/ruby_1_9_and_2_0_support.rb +3 -3
- data/lib/persistent_dmnd/self_conversion.rb +3 -3
- data/lib/persistent_dmnd/set.rb +9 -9
- data/lib/persistent_dmnd/version.rb +3 -3
- data/persistent-dmnd.gemspec +28 -25
- data/sorbet/rbi/gems/concurrent-ruby.rbi +97 -24
- data/sorbet/rbi/gems/hamster.rbi +1 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +1768 -689
- data/sorbet/rbi/hidden-definitions/hidden.rbi +2624 -1321
- data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +645 -0
- data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +1891 -0
- data/sorbet/rbi/todo.rbi +3 -3
- metadata +12 -28
- data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +0 -8684
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +0 -4222
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +0 -111
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +0 -543
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 997bf52e7c42eede7ff1aec2b935b454de180a9249d07079b0f8e10826fbdf76
|
4
|
+
data.tar.gz: ccdbe8004757f456bfe7258d38881f4fea3341cb789325a3de230b350105a226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eb571c134ee04d62521169e519052be1d064c4e8fe6b2003a8e89184366b4fb4e760104a29f4e33aef195eead23b909a905ad09105abdd743217dd94e2a614d
|
7
|
+
data.tar.gz: f2ea7b05c3d4dae505b71bc90002280f478548916297193b85afc162011ff2d72b3594737aadaa542e5f2af7adf2d2f23e842e82252143560dd5fad0fab276d8
|
data/.gitlab-ci.yml
CHANGED
@@ -233,6 +233,28 @@ testruby_3_0:
|
|
233
233
|
script:
|
234
234
|
- bin/rspec
|
235
235
|
|
236
|
+
testruby_3_1:
|
237
|
+
image: "ruby:3.1.0"
|
238
|
+
|
239
|
+
# Cache gems in between builds
|
240
|
+
cache:
|
241
|
+
paths:
|
242
|
+
- vendor/ruby
|
243
|
+
|
244
|
+
before_script:
|
245
|
+
- apt-get update >/dev/null # Add UTF-8 support
|
246
|
+
- apt-get install -y locales >/dev/null # |
|
247
|
+
- echo "en_US UTF-8" > /etc/locale.gen # |
|
248
|
+
- locale-gen en_US.UTF-8 # |
|
249
|
+
- export LANG=en_US.UTF-8 # |
|
250
|
+
- export LANGUAGE=en_US:en # |
|
251
|
+
- export LC_ALL=en_US.UTF-8 # v
|
252
|
+
- ruby -v # Print out ruby version for debugging
|
253
|
+
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
254
|
+
|
255
|
+
script:
|
256
|
+
- bin/rspec
|
257
|
+
|
236
258
|
testjruby_1_7:
|
237
259
|
image: "jruby:1.7"
|
238
260
|
|
@@ -313,8 +335,10 @@ testjruby_9_1:
|
|
313
335
|
script:
|
314
336
|
- bin/rspec
|
315
337
|
|
316
|
-
|
317
|
-
|
338
|
+
# This is not repeated from the 9.2 below! 9.2.0.0 is a very specific version with a bug in the Set interoperability so
|
339
|
+
# we'll want to check that our workaround is working with this one even after the 9.2 branch moves on.
|
340
|
+
testjruby9_2_0_0:
|
341
|
+
image: "jruby:9.2.0.0"
|
318
342
|
|
319
343
|
# Cache gems in between builds
|
320
344
|
cache:
|
@@ -332,17 +356,14 @@ testjruby_9_1:
|
|
332
356
|
- apt-get install -y git >/dev/null # Add git binary
|
333
357
|
- export JRUBY_OPTS=--dev # Faster test runs
|
334
358
|
- ruby -v # Print out ruby version for debugging
|
335
|
-
- gem uninstall -x -i /opt/jruby/lib/ruby/gems/shared bundler # Remove any pre-existing bundler
|
336
359
|
- gem install bundler:'< 2' # Bundler is not installed with the image
|
337
360
|
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
338
361
|
|
339
362
|
script:
|
340
363
|
- bin/rspec
|
341
364
|
|
342
|
-
|
343
|
-
|
344
|
-
testjruby9_2_0_0:
|
345
|
-
image: "jruby:9.2.0.0"
|
365
|
+
testjruby_9_2:
|
366
|
+
image: "jruby:9.2"
|
346
367
|
|
347
368
|
# Cache gems in between builds
|
348
369
|
cache:
|
@@ -360,14 +381,15 @@ testjruby9_2_0_0:
|
|
360
381
|
- apt-get install -y git >/dev/null # Add git binary
|
361
382
|
- export JRUBY_OPTS=--dev # Faster test runs
|
362
383
|
- ruby -v # Print out ruby version for debugging
|
384
|
+
- gem uninstall -a -x -i /opt/jruby/lib/ruby/gems/shared bundler # Remove any pre-existing bundler
|
363
385
|
- gem install bundler:'< 2' # Bundler is not installed with the image
|
364
386
|
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
365
387
|
|
366
388
|
script:
|
367
389
|
- bin/rspec
|
368
390
|
|
369
|
-
|
370
|
-
image: "jruby:9.
|
391
|
+
testjruby_9_3:
|
392
|
+
image: "jruby:9.3"
|
371
393
|
|
372
394
|
# Cache gems in between builds
|
373
395
|
cache:
|
@@ -385,18 +407,34 @@ testjruby_9_2:
|
|
385
407
|
- apt-get install -y git >/dev/null # Add git binary
|
386
408
|
- export JRUBY_OPTS=--dev # Faster test runs
|
387
409
|
- ruby -v # Print out ruby version for debugging
|
388
|
-
- gem uninstall -a -x -i /opt/jruby/lib/ruby/gems/shared bundler # Remove any pre-existing bundler
|
389
|
-
- gem install bundler:'< 2' # Bundler is not installed with the image
|
390
410
|
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
391
411
|
|
392
412
|
script:
|
393
413
|
- bin/rspec
|
394
414
|
|
395
|
-
|
396
|
-
image: "
|
415
|
+
testtruffleruby_20_2_0:
|
416
|
+
image: "flavorjones/truffleruby:20.2.0-buster"
|
417
|
+
|
418
|
+
before_script:
|
419
|
+
- apt-get update >/dev/null # Add UTF-8 support
|
420
|
+
- apt-get install -y locales >/dev/null # |
|
421
|
+
- echo "en_US UTF-8" > /etc/locale.gen # |
|
422
|
+
- locale-gen en_US.UTF-8 # |
|
423
|
+
- export LANG=en_US.UTF-8 # |
|
424
|
+
- export LANGUAGE=en_US:en # |
|
425
|
+
- export LC_ALL=en_US.UTF-8 # v
|
426
|
+
- apt-get install -y git >/dev/null # Add git binary
|
427
|
+
- ruby -v # Print out ruby version for debugging
|
428
|
+
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
429
|
+
|
430
|
+
script:
|
431
|
+
- bin/rspec
|
432
|
+
|
433
|
+
|
434
|
+
testtruffleruby_21_3_0:
|
435
|
+
image: "ghcr.io/flavorjones/truffleruby:21.3.0"
|
397
436
|
|
398
437
|
before_script:
|
399
|
-
- gu install -c org.graalvm.ruby # Install TruffleRuby
|
400
438
|
- apt-get update >/dev/null # Add UTF-8 support
|
401
439
|
- apt-get install -y locales >/dev/null # |
|
402
440
|
- echo "en_US UTF-8" > /etc/locale.gen # |
|
@@ -404,11 +442,9 @@ testtruffleruby:
|
|
404
442
|
- export LANG=en_US.UTF-8 # |
|
405
443
|
- export LANGUAGE=en_US:en # |
|
406
444
|
- export LC_ALL=en_US.UTF-8 # v
|
407
|
-
- apt-get install -y git
|
408
|
-
- /graalvm*/jre/languages/ruby/lib/truffle/post_install_hook.sh # Rebuild openssl extension, as suggested by install
|
409
|
-
# notes
|
445
|
+
- apt-get install -y git >/dev/null # Add git binary
|
410
446
|
- ruby -v # Print out ruby version for debugging
|
411
|
-
- bundle install -j $(nproc)
|
447
|
+
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
412
448
|
|
413
449
|
script:
|
414
450
|
- bin/rspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-3.0.
|
1
|
+
ruby-3.0.2
|
data/CODE_OF_CONDUCT.adoc
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
== Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at ivo
|
58
|
+
reported by contacting the project team at ivo@ivoanjo.me. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/LICENSE
CHANGED
data/README.adoc
CHANGED
@@ -97,7 +97,7 @@ It also (_optionally!_) interoperates with the https://github.com/ruby-concurren
|
|
97
97
|
Underneath the covers, persistent-💎 mostly builds atop the awesome https://github.com/hamstergem/hamster[hamster gem].
|
98
98
|
Big thanks to its equally-awesome authors!
|
99
99
|
|
100
|
-
Persistent-💎 is fully supported and tested on Ruby versions 1.9.3 to 3.
|
100
|
+
Persistent-💎 is fully supported and tested on Ruby versions 1.9.3 to 3.1, JRuby 1.7 to 9.3, and TruffleRuby 🎉.
|
101
101
|
If we don't support your Ruby, it's probably a Python binary instead (or a potato?).
|
102
102
|
Keep calm and 💎 away!
|
103
103
|
|
data/gems.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# typed: false
|
3
3
|
|
4
|
-
source
|
4
|
+
source "https://rubygems.org"
|
5
5
|
|
6
6
|
gemspec
|
7
7
|
|
8
8
|
# Specify ffi version to avoid dependency issues when switching between MRI
|
9
9
|
# and JRuby with the same gems.lock
|
10
10
|
# Only used in development
|
11
|
-
gem
|
11
|
+
gem "ffi", "~> 1.9.18"
|
data/lib/persistent-dmnd.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: strong
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,4 +30,4 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
33
|
+
require "persistent-💎"
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,12 +30,12 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
37
|
-
require
|
38
|
-
require
|
33
|
+
require "persistent_dmnd/version"
|
34
|
+
require "persistent_dmnd/array"
|
35
|
+
require "persistent_dmnd/hash"
|
36
|
+
require "persistent_dmnd/set"
|
37
|
+
require "persistent_dmnd/dmndifier"
|
38
|
+
require "persistent_dmnd/jruby_workaround"
|
39
39
|
|
40
40
|
module Persistent💎
|
41
41
|
include JRubyWorkaround
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: false
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,13 +30,13 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
33
|
+
require "persistent_dmnd/self_conversion"
|
34
|
+
require "persistent_dmnd/is_persistent"
|
35
|
+
require "persistent_dmnd/concurrent_ruby_support"
|
36
|
+
require "persistent_dmnd/jruby_workaround"
|
37
37
|
|
38
|
-
require
|
39
|
-
require
|
38
|
+
require "hamster"
|
39
|
+
require "set"
|
40
40
|
|
41
41
|
module Persistent💎
|
42
42
|
class Array < Hamster::Vector
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
33
|
+
require "thread"
|
34
34
|
|
35
35
|
module Persistent💎
|
36
36
|
# Simple module that attempts to load concurrent-ruby, and then stores the result for quick lookup
|
@@ -52,7 +52,7 @@ module Persistent💎
|
|
52
52
|
|
53
53
|
begin
|
54
54
|
REQUIRE_MUTEX.synchronize do # Avoid require races
|
55
|
-
require
|
55
|
+
require "concurrent"
|
56
56
|
end
|
57
57
|
mark_as_success
|
58
58
|
true
|
@@ -66,7 +66,7 @@ module Persistent💎
|
|
66
66
|
|
67
67
|
def raise_no_concurrent_ruby
|
68
68
|
raise(NotImplementedError,
|
69
|
-
|
69
|
+
"concurrent-ruby gem is not available, please install it in order to use #to_concurrent and #to_concurrent_* methods")
|
70
70
|
end
|
71
71
|
|
72
72
|
# The following methods are only for internal and test usage. Please do not use them :)
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,9 +30,9 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
33
|
+
require "persistent_dmnd/ruby_1_9_and_2_0_support"
|
34
34
|
|
35
|
-
require
|
35
|
+
require "hamster"
|
36
36
|
|
37
37
|
module Persistent💎
|
38
38
|
class Dmndifier
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
# typed:
|
3
|
-
|
2
|
+
# typed: strict
|
4
3
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
4
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
5
|
#
|
7
6
|
# This file is part of Persistent-💎.
|
8
7
|
#
|
9
8
|
# MIT License
|
10
9
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
10
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
11
|
#
|
13
12
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
13
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,7 +29,7 @@
|
|
30
29
|
|
31
30
|
# frozen_string_literal: true
|
32
31
|
|
33
|
-
require
|
32
|
+
require "persistent-💎"
|
34
33
|
|
35
34
|
# Add our module to the main object, allowing our syntax to be used everywhere
|
36
35
|
include Persistent💎
|
data/lib/persistent_dmnd/hash.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: false
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,13 +30,13 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
33
|
+
require "persistent_dmnd/self_conversion"
|
34
|
+
require "persistent_dmnd/is_persistent"
|
35
|
+
require "persistent_dmnd/concurrent_ruby_support"
|
36
|
+
require "persistent_dmnd/jruby_workaround"
|
37
37
|
|
38
|
-
require
|
39
|
-
require
|
38
|
+
require "hamster"
|
39
|
+
require "set"
|
40
40
|
|
41
41
|
module Persistent💎
|
42
42
|
class Hash < Hamster::Hash
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# typed: false
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017-
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎, and parts were inspired by Ruby's set.rb
|
8
8
|
# https://github.com/ruby/ruby/blob/v2_6_0_preview2/lib/set.rb
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
# frozen_string_literal: true
|
14
14
|
|
15
|
-
require
|
15
|
+
require "set"
|
16
16
|
|
17
17
|
module Persistent💎
|
18
18
|
# Workaround for https://github.com/jruby/jruby/issues/5227
|
@@ -43,7 +43,7 @@ module Persistent💎
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
if RUBY_PLATFORM ==
|
46
|
+
if RUBY_PLATFORM == "java" && (JRUBY_VERSION.start_with?("9.2.") || JRUBY_VERSION.start_with?("9.3.")) && workaround_needed?
|
47
47
|
class ::Set
|
48
48
|
# Save existing Set methods
|
49
49
|
|
@@ -108,13 +108,11 @@ module Persistent💎
|
|
108
108
|
persistent_dmnd_workaround_original_disjoint?(set)
|
109
109
|
rescue ArgumentError => e
|
110
110
|
raise unless e.message == "value must be a set" && set.is_a?(::Set)
|
111
|
-
!(
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
117
|
-
)
|
111
|
+
!(if size < set.size
|
112
|
+
any? { |o| set.include?(o) }
|
113
|
+
else
|
114
|
+
set.any? { |o| include?(o) }
|
115
|
+
end)
|
118
116
|
end
|
119
117
|
|
120
118
|
def flatten_merge(set, seen = ::Set.new)
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: false
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -32,11 +32,11 @@
|
|
32
32
|
|
33
33
|
module Persistent💎
|
34
34
|
module JRubyWorkaround
|
35
|
-
if RUBY_PLATFORM ==
|
35
|
+
if RUBY_PLATFORM == "java" && JRUBY_VERSION < "9.2.0.0" # Only supposed to do something on legacy JRuby versions
|
36
36
|
BROKEN_ENCODING = "\x00"
|
37
37
|
private_constant :BROKEN_ENCODING
|
38
38
|
|
39
|
-
BROKEN_ENCODING_JRUBY_1_7 = [239, 146, 142].pack(
|
39
|
+
BROKEN_ENCODING_JRUBY_1_7 = [239, 146, 142].pack("c*").force_encoding("UTF-8")
|
40
40
|
private_constant :BROKEN_ENCODING_JRUBY_1_7
|
41
41
|
|
42
42
|
def self.included(klass)
|
@@ -81,25 +81,25 @@ module Persistent💎
|
|
81
81
|
def maybe_fix_broken_encoding(name, target = nil)
|
82
82
|
name_string = name.to_s
|
83
83
|
|
84
|
-
if JRUBY_VERSION.start_with?(
|
84
|
+
if JRUBY_VERSION.start_with?("1.7.")
|
85
85
|
unless name_string.match(/\?.+/) ||
|
86
|
-
[
|
87
|
-
[
|
86
|
+
["a?", "h?", "s?", "each?"].include?(name_string) ||
|
87
|
+
["_?", "_a?", "_h?", "_s?"].any? { |suffix| name_string.end_with?(suffix) }
|
88
88
|
return
|
89
89
|
end
|
90
90
|
else
|
91
91
|
return unless name_string.end_with?(BROKEN_ENCODING)
|
92
92
|
end
|
93
93
|
|
94
|
-
fixed_name = name_string.sub(
|
95
|
-
fixed_name_jruby_1_7 = name_string.sub(
|
94
|
+
fixed_name = name_string.sub("?", "💎").delete(BROKEN_ENCODING).to_sym
|
95
|
+
fixed_name_jruby_1_7 = name_string.sub("?", BROKEN_ENCODING_JRUBY_1_7).to_sym
|
96
96
|
|
97
97
|
if target
|
98
98
|
target.instance_eval { alias_method(fixed_name, name) }
|
99
|
-
target.instance_eval { alias_method(fixed_name_jruby_1_7, name) } if JRUBY_VERSION.start_with?(
|
99
|
+
target.instance_eval { alias_method(fixed_name_jruby_1_7, name) } if JRUBY_VERSION.start_with?("1.7.")
|
100
100
|
else
|
101
101
|
alias_method(fixed_name, name)
|
102
|
-
alias_method(fixed_name_jruby_1_7, name) if JRUBY_VERSION.start_with?(
|
102
|
+
alias_method(fixed_name_jruby_1_7, name) if JRUBY_VERSION.start_with?("1.7.")
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -33,7 +33,7 @@
|
|
33
33
|
module Persistent💎
|
34
34
|
module Ruby19And20Support
|
35
35
|
# Enumerable#to_h was only introduced in Ruby 2.1 so we have to do it by hand on 2.0/1.9
|
36
|
-
if RUBY_VERSION.start_with?(
|
36
|
+
if RUBY_VERSION.start_with?("2.0.") || RUBY_VERSION.start_with?("1.9.")
|
37
37
|
def self.enumerable_to_h(enumerable)
|
38
38
|
enumerable.each_with_object({}) do |(key, value), result|
|
39
39
|
result[key] = value
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
33
|
+
require "persistent_dmnd/jruby_workaround"
|
34
34
|
|
35
35
|
module Persistent💎
|
36
36
|
# Implements trivial conversion to persistent data structures for our own classes
|
data/lib/persistent_dmnd/set.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
# Persistent-💎: Ruby gem for easily creating immutable data structures
|
5
|
-
# Copyright (c) 2017 Ivo Anjo <ivo
|
5
|
+
# Copyright (c) 2017-2021 Ivo Anjo <ivo@ivoanjo.me>
|
6
6
|
#
|
7
7
|
# This file is part of Persistent-💎.
|
8
8
|
#
|
9
9
|
# MIT License
|
10
10
|
#
|
11
|
-
# Copyright (c) 2017 Ivo Anjo
|
11
|
+
# Copyright (c) 2017-2021 Ivo Anjo
|
12
12
|
#
|
13
13
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
14
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -30,14 +30,14 @@
|
|
30
30
|
|
31
31
|
# frozen_string_literal: true
|
32
32
|
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
37
|
-
require
|
33
|
+
require "persistent_dmnd/self_conversion"
|
34
|
+
require "persistent_dmnd/is_persistent"
|
35
|
+
require "persistent_dmnd/concurrent_ruby_support"
|
36
|
+
require "persistent_dmnd/jruby_workaround"
|
37
|
+
require "persistent_dmnd/jruby_9_2_set_workaround"
|
38
38
|
|
39
|
-
require
|
40
|
-
require
|
39
|
+
require "hamster"
|
40
|
+
require "set"
|
41
41
|
|
42
42
|
module Persistent💎
|
43
43
|
class Set < Hamster::Set
|