persistent-dmnd 2.0.2 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +108 -22
  3. data/.ruby-version +1 -1
  4. data/CODE_OF_CONDUCT.adoc +1 -1
  5. data/LICENSE +1 -1
  6. data/README.adoc +1 -1
  7. data/gems.rb +2 -2
  8. data/lib/persistent-dmnd.rb +3 -3
  9. data/lib/persistent-/360/237/222/216.rb +8 -8
  10. data/lib/persistent_dmnd/array.rb +8 -8
  11. data/lib/persistent_dmnd/concurrent_ruby_support.rb +5 -5
  12. data/lib/persistent_dmnd/dmndifier.rb +4 -4
  13. data/lib/persistent_dmnd/everywhere.rb +4 -5
  14. data/lib/persistent_dmnd/hash.rb +8 -8
  15. data/lib/persistent_dmnd/is_persistent.rb +2 -2
  16. data/lib/persistent_dmnd/jruby_9_2_set_workaround.rb +23 -10
  17. data/lib/persistent_dmnd/jruby_workaround.rb +11 -11
  18. data/lib/persistent_dmnd/ruby_1_9_and_2_0_support.rb +3 -3
  19. data/lib/persistent_dmnd/self_conversion.rb +3 -3
  20. data/lib/persistent_dmnd/set.rb +9 -9
  21. data/lib/persistent_dmnd/version.rb +3 -3
  22. data/persistent-dmnd.gemspec +28 -25
  23. data/sorbet/rbi/gems/concurrent-ruby.rbi +97 -24
  24. data/sorbet/rbi/gems/hamster.rbi +1 -0
  25. data/sorbet/rbi/hidden-definitions/errors.txt +1768 -689
  26. data/sorbet/rbi/hidden-definitions/hidden.rbi +2624 -1321
  27. data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +645 -0
  28. data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +1891 -0
  29. data/sorbet/rbi/todo.rbi +3 -3
  30. metadata +46 -20
  31. data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +0 -8684
  32. data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +0 -4222
  33. data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +0 -111
  34. 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: 8b879b9c77d3a45c968c749d87e6c55122a80a79ed5663e6654395459288ca91
4
- data.tar.gz: d2a79f2aeb43dffaddff8b984e1ebb020375b76f6a626206e8625543ea5c2ba3
3
+ metadata.gz: 941854bf9185d3078b878c25f4888315c2c29f0b823f453d10a44a89f733d7c4
4
+ data.tar.gz: cbb85dd3e9251e9800f00223c1a3a0ffc6764023593a0791e0289f94c431e1d0
5
5
  SHA512:
6
- metadata.gz: d3f3ff75d7339f563f33f3e532bdf21e7ec126f8bf6024a62b99c1743ae7710187293a82b560cbf6cd34ae26181312d31a36214fa65ce24049bb31bdee4f758d
7
- data.tar.gz: 6f136975f55d67f33662363931c000e0cb30f6e28da2cd5956eb6bf641d8b6bc9e53ea3d22bcc1fa20627499cc90ec1e8663e19beb615c788b7dc5723c8ca008
6
+ metadata.gz: efa93ab8dd9c78d2f65cc736cf4001e3631ab546ce19dec796843611191e152c6198d9c71aaf2c6b4bfe69d17bd942d12da2612c141af077d8abc4165c4a99ec
7
+ data.tar.gz: 3e43b4f670e76b820bbf48d7115a14cfbe29ef7ddb94702df4e981a773946398d1f4d6b271cc35cb838f136b5e4f2dd15a6490498a3e2207e70b02defd1dfa14
data/.gitlab-ci.yml CHANGED
@@ -10,8 +10,9 @@ testruby_1_9_3:
10
10
  - vendor/ruby
11
11
 
12
12
  before_script:
13
- - printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
14
- - apt-get update >/dev/null # Add UTF-8 support
13
+ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA8E81B4331F7F50 7638D0442B90D010 8B48AD6246925553
14
+ - echo "deb [trusted=yes] http://archive.debian.org/debian/ jessie main contrib non-free" | tee /etc/apt/sources.list
15
+ - apt-get update # Add UTF-8 support
15
16
  - apt-get install -y locales >/dev/null # |
16
17
  - echo "en_US UTF-8" > /etc/locale.gen # |
17
18
  - locale-gen en_US.UTF-8 # |
@@ -34,8 +35,9 @@ testruby_2_0:
34
35
  - vendor/ruby
35
36
 
36
37
  before_script:
37
- - printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
38
- - apt-get update >/dev/null # Add UTF-8 support
38
+ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA8E81B4331F7F50 7638D0442B90D010 8B48AD6246925553
39
+ - echo "deb [trusted=yes] http://archive.debian.org/debian/ jessie main contrib non-free" | tee /etc/apt/sources.list
40
+ - apt-get update # Add UTF-8 support
39
41
  - apt-get install -y locales >/dev/null # |
40
42
  - echo "en_US UTF-8" > /etc/locale.gen # |
41
43
  - locale-gen en_US.UTF-8 # |
@@ -233,6 +235,50 @@ testruby_3_0:
233
235
  script:
234
236
  - bin/rspec
235
237
 
238
+ testruby_3_1:
239
+ image: "ruby:3.1.0"
240
+
241
+ # Cache gems in between builds
242
+ cache:
243
+ paths:
244
+ - vendor/ruby
245
+
246
+ before_script:
247
+ - apt-get update >/dev/null # Add UTF-8 support
248
+ - apt-get install -y locales >/dev/null # |
249
+ - echo "en_US UTF-8" > /etc/locale.gen # |
250
+ - locale-gen en_US.UTF-8 # |
251
+ - export LANG=en_US.UTF-8 # |
252
+ - export LANGUAGE=en_US:en # |
253
+ - export LC_ALL=en_US.UTF-8 # v
254
+ - ruby -v # Print out ruby version for debugging
255
+ - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
256
+
257
+ script:
258
+ - bin/rspec
259
+
260
+ testruby_3_2:
261
+ image: "ruby:3.2.0"
262
+
263
+ # Cache gems in between builds
264
+ cache:
265
+ paths:
266
+ - vendor/ruby
267
+
268
+ before_script:
269
+ - apt-get update >/dev/null # Add UTF-8 support
270
+ - apt-get install -y locales >/dev/null # |
271
+ - echo "en_US UTF-8" > /etc/locale.gen # |
272
+ - locale-gen en_US.UTF-8 # |
273
+ - export LANG=en_US.UTF-8 # |
274
+ - export LANGUAGE=en_US:en # |
275
+ - export LC_ALL=en_US.UTF-8 # v
276
+ - ruby -v # Print out ruby version for debugging
277
+ - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
278
+
279
+ script:
280
+ - bin/rspec
281
+
236
282
  testjruby_1_7:
237
283
  image: "jruby:1.7"
238
284
 
@@ -268,6 +314,8 @@ testjruby_9_0:
268
314
 
269
315
  before_script:
270
316
  - rm /etc/apt/sources.list.d/jessie-backports.list
317
+ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA8E81B4331F7F50 7638D0442B90D010 8B48AD6246925553
318
+ - echo "deb [trusted=yes] http://archive.debian.org/debian/ jessie main contrib non-free" | tee /etc/apt/sources.list
271
319
  - apt-get update # Add UTF-8 support
272
320
  - apt-get install -y locales >/dev/null # |
273
321
  - echo "en_US UTF-8" > /etc/locale.gen # |
@@ -313,8 +361,10 @@ testjruby_9_1:
313
361
  script:
314
362
  - bin/rspec
315
363
 
316
- testjruby_9_1:
317
- image: "jruby:9.1"
364
+ # 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
365
+ # we'll want to check that our workaround is working with this one even after the 9.2 branch moves on.
366
+ testjruby9_2_0_0:
367
+ image: "jruby:9.2.0.0"
318
368
 
319
369
  # Cache gems in between builds
320
370
  cache:
@@ -332,17 +382,14 @@ testjruby_9_1:
332
382
  - apt-get install -y git >/dev/null # Add git binary
333
383
  - export JRUBY_OPTS=--dev # Faster test runs
334
384
  - 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
385
  - gem install bundler:'< 2' # Bundler is not installed with the image
337
386
  - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
338
387
 
339
388
  script:
340
389
  - bin/rspec
341
390
 
342
- # 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
343
- # we'll want to check that our workaround is working with this one even after the 9.2 branch moves on.
344
- testjruby9_2_0_0:
345
- image: "jruby:9.2.0.0"
391
+ testjruby_9_2:
392
+ image: "jruby:9.2"
346
393
 
347
394
  # Cache gems in between builds
348
395
  cache:
@@ -360,14 +407,15 @@ testjruby9_2_0_0:
360
407
  - apt-get install -y git >/dev/null # Add git binary
361
408
  - export JRUBY_OPTS=--dev # Faster test runs
362
409
  - ruby -v # Print out ruby version for debugging
410
+ - gem uninstall -a -x -i /opt/jruby/lib/ruby/gems/shared bundler # Remove any pre-existing bundler
363
411
  - gem install bundler:'< 2' # Bundler is not installed with the image
364
412
  - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
365
413
 
366
414
  script:
367
415
  - bin/rspec
368
416
 
369
- testjruby_9_2:
370
- image: "jruby:9.2"
417
+ testjruby_9_3:
418
+ image: "jruby:9.3"
371
419
 
372
420
  # Cache gems in between builds
373
421
  cache:
@@ -385,18 +433,58 @@ testjruby_9_2:
385
433
  - apt-get install -y git >/dev/null # Add git binary
386
434
  - export JRUBY_OPTS=--dev # Faster test runs
387
435
  - 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
436
  - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
391
437
 
392
438
  script:
393
439
  - bin/rspec
394
440
 
395
- testtruffleruby:
396
- image: "danny02/graalvm"
441
+ testjruby_9_4:
442
+ image: "jruby:9.4"
443
+
444
+ # Cache gems in between builds
445
+ cache:
446
+ paths:
447
+ - vendor/ruby
448
+
449
+ before_script:
450
+ - apt-get update >/dev/null # Add UTF-8 support
451
+ - apt-get install -y locales >/dev/null # |
452
+ - echo "en_US UTF-8" > /etc/locale.gen # |
453
+ - locale-gen en_US.UTF-8 # |
454
+ - export LANG=en_US.UTF-8 # |
455
+ - export LANGUAGE=en_US:en # |
456
+ - export LC_ALL=en_US.UTF-8 # v
457
+ - apt-get install -y git >/dev/null # Add git binary
458
+ - export JRUBY_OPTS=--dev # Faster test runs
459
+ - ruby -v # Print out ruby version for debugging
460
+ - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
461
+
462
+ script:
463
+ - bin/rspec
464
+
465
+ testtruffleruby_20_2_0:
466
+ image: "flavorjones/truffleruby:20.2.0-buster"
467
+
468
+ before_script:
469
+ - apt-get update >/dev/null # Add UTF-8 support
470
+ - apt-get install -y locales >/dev/null # |
471
+ - echo "en_US UTF-8" > /etc/locale.gen # |
472
+ - locale-gen en_US.UTF-8 # |
473
+ - export LANG=en_US.UTF-8 # |
474
+ - export LANGUAGE=en_US:en # |
475
+ - export LC_ALL=en_US.UTF-8 # v
476
+ - apt-get install -y git >/dev/null # Add git binary
477
+ - ruby -v # Print out ruby version for debugging
478
+ - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
479
+
480
+ script:
481
+ - bin/rspec
482
+
483
+
484
+ testtruffleruby_21_3_0:
485
+ image: "ghcr.io/flavorjones/truffleruby:21.3.0"
397
486
 
398
487
  before_script:
399
- - gu install -c org.graalvm.ruby # Install TruffleRuby
400
488
  - apt-get update >/dev/null # Add UTF-8 support
401
489
  - apt-get install -y locales >/dev/null # |
402
490
  - echo "en_US UTF-8" > /etc/locale.gen # |
@@ -404,11 +492,9 @@ testtruffleruby:
404
492
  - export LANG=en_US.UTF-8 # |
405
493
  - export LANGUAGE=en_US:en # |
406
494
  - export LC_ALL=en_US.UTF-8 # v
407
- - apt-get install -y git libssl-dev libssl1.1 clang llvm make >/dev/null # Add git binary + truffleruby dependencies
408
- - /graalvm*/jre/languages/ruby/lib/truffle/post_install_hook.sh # Rebuild openssl extension, as suggested by install
409
- # notes
495
+ - apt-get install -y git >/dev/null # Add git binary
410
496
  - ruby -v # Print out ruby version for debugging
411
- - bundle install -j $(nproc) # Install dependencies
497
+ - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
412
498
 
413
499
  script:
414
500
  - bin/rspec
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.0.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.anjo@ist.utl.pt. All
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
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 Ivo Anjo
3
+ Copyright (c) 2017-2021 Ivo Anjo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.0.0, JRuby 1.7 to 9.2, and TruffleRuby 1.0+ 🎉.
100
+ Persistent-💎 is fully supported and tested on Ruby versions 1.9.3 to 3.2, JRuby 1.7 to 9.4, 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 'https://rubygems.org'
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 'ffi', '~> 1.9.18'
11
+ gem "ffi", "~> 1.9.18"
@@ -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.anjo@ist.utl.pt>
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 'persistent-💎'
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.anjo@ist.utl.pt>
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 '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'
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.anjo@ist.utl.pt>
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 'persistent_dmnd/self_conversion'
34
- require 'persistent_dmnd/is_persistent'
35
- require 'persistent_dmnd/concurrent_ruby_support'
36
- require 'persistent_dmnd/jruby_workaround'
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 'hamster'
39
- require 'set'
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.anjo@ist.utl.pt>
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 'thread'
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 'concurrent'
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
- 'concurrent-ruby gem is not available, please install it in order to use #to_concurrent and #to_concurrent_* methods')
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.anjo@ist.utl.pt>
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 'persistent_dmnd/ruby_1_9_and_2_0_support'
33
+ require "persistent_dmnd/ruby_1_9_and_2_0_support"
34
34
 
35
- require 'hamster'
35
+ require "hamster"
36
36
 
37
37
  module Persistent💎
38
38
  class Dmndifier
@@ -1,14 +1,13 @@
1
1
  # encoding: UTF-8
2
- # typed: ignore
3
-
2
+ # typed: strict
4
3
  # Persistent-💎: Ruby gem for easily creating immutable data structures
5
- # Copyright (c) 2017 Ivo Anjo <ivo.anjo@ist.utl.pt>
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 'persistent-💎'
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💎
@@ -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.anjo@ist.utl.pt>
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 'persistent_dmnd/self_conversion'
34
- require 'persistent_dmnd/is_persistent'
35
- require 'persistent_dmnd/concurrent_ruby_support'
36
- require 'persistent_dmnd/jruby_workaround'
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 'hamster'
39
- require 'set'
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.anjo@ist.utl.pt>
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-2018 Ivo Anjo <ivo.anjo@ist.utl.pt>
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 'set'
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 == 'java' && JRUBY_VERSION.start_with?('9.2.') && workaround_needed?
46
+ if RUBY_PLATFORM == "java" && (JRUBY_VERSION.start_with?("9.2.") || JRUBY_VERSION.start_with?("9.3.") || JRUBY_VERSION.start_with?("9.4.")) && workaround_needed?
47
47
  class ::Set
48
48
  # Save existing Set methods
49
49
 
@@ -57,9 +57,24 @@ module Persistent💎
57
57
  alias persistent_dmnd_workaround_original_flatten_merge flatten_merge
58
58
  alias persistent_dmnd_workaround_original_flatten flatten
59
59
  alias persistent_dmnd_workaround_original_flatten! flatten!
60
+ alias persistend_dmnd_workaround_original_spaceship <=>
60
61
 
61
62
  # Redefine all set methods that use instanceof RubySet to restore previous behavior
62
63
 
64
+ if JRUBY_VERSION.start_with?("9.4.")
65
+ def <=>(set)
66
+ original = persistend_dmnd_workaround_original_spaceship(set)
67
+ return original if original
68
+
69
+ return unless set.is_a?(::Set)
70
+ case size <=> set.size
71
+ when -1 then -1 if proper_subset?(set)
72
+ when +1 then +1 if proper_superset?(set)
73
+ else 0 if self.==(set)
74
+ end
75
+ end
76
+ end
77
+
63
78
  def ==(other)
64
79
  persistent_dmnd_workaround_original_equal(other) ||
65
80
  (other.is_a?(::Set) && size == other.size && other.all? { |o| include?(o) })
@@ -108,13 +123,11 @@ module Persistent💎
108
123
  persistent_dmnd_workaround_original_disjoint?(set)
109
124
  rescue ArgumentError => e
110
125
  raise unless e.message == "value must be a set" && set.is_a?(::Set)
111
- !(
112
- if size < set.size
113
- any? { |o| set.include?(o) }
114
- else
115
- set.any? { |o| include?(o) }
116
- end
117
- )
126
+ !(if size < set.size
127
+ any? { |o| set.include?(o) }
128
+ else
129
+ set.any? { |o| include?(o) }
130
+ end)
118
131
  end
119
132
 
120
133
  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.anjo@ist.utl.pt>
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 == 'java' && JRUBY_VERSION < "9.2.0.0" # Only supposed to do something on legacy JRuby versions
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('c*').force_encoding('UTF-8')
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?('1.7.')
84
+ if JRUBY_VERSION.start_with?("1.7.")
85
85
  unless name_string.match(/\?.+/) ||
86
- ['a?', 'h?', 's?', 'each?'].include?(name_string) ||
87
- ['_?', '_a?', '_h?', '_s?'].any? { |suffix| name_string.end_with?(suffix) }
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('?', '💎').delete(BROKEN_ENCODING).to_sym
95
- fixed_name_jruby_1_7 = name_string.sub('?', BROKEN_ENCODING_JRUBY_1_7).to_sym
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?('1.7.')
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?('1.7.')
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