set 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0553df841f04a61495ba77ce0545d0cf8fe2317a8d4113235bc0ffed4a798f9
4
- data.tar.gz: a0f42b54d9f2d61932e9b781a8adc33e7fa28eef1e0fe646d51e4cb8a10aac9f
3
+ metadata.gz: cef560e603f6d6413751c31bb94fddf3838a66af8e71cff73c74760ff479ff6a
4
+ data.tar.gz: 448e22e93eebe57b26200fc1c8be476d60494193136aabb09a50c68e878e96cf
5
5
  SHA512:
6
- metadata.gz: 96305ae873bfaf18381f91252201245ef4322ada12644358f0d8d310c54722dac39d6c79b26a270322931d9d4848955542acc3912ec57c75b57bca38994806c3
7
- data.tar.gz: 77adbb45986b8203e9e11da2e0eea741b36903a2017c4d5d1898b9700b82ec19e1bbff27883e3c485e991cdc67b3f0bde9582605c0a84ed1fc9322409ddad284
6
+ metadata.gz: 91fa3052d7f25eaf6c0066013a5bd2d0c58961fe330c8923853634bac908ae83323d01b26ec8f85c4ab1ae309a83cc8e30e0918802ebb6f96fc3fcb7b7bdd433
7
+ data.tar.gz: 07b57081279057d476e1fe7c07587db1de0243cb78d36bc04b5b3ed303643b54320f08e98ed3672e610df84c42f0d503c7fae7eba040d2cf260c84319e7f9745
@@ -7,7 +7,7 @@ jobs:
7
7
  name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ 3.2, 3.1, "3.0", 2.7, head ]
10
+ ruby: [ 3.2, 3.1, "3.0", head ]
11
11
  os: [ ubuntu-latest, macos-latest ]
12
12
  runs-on: ${{ matrix.os }}
13
13
  steps:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Set Changelog
2
2
 
3
+ # 1.1.0 (2023-12-23)
4
+
5
+ * Optimize for and require Ruby >=3
6
+
3
7
  # 1.0.4 (2023-12-08)
4
8
 
5
9
  * Enhancements
data/lib/set.rb CHANGED
@@ -216,7 +216,7 @@
216
216
  # has been modified while an element in the set.
217
217
  #
218
218
  class Set
219
- VERSION = "1.0.4"
219
+ VERSION = "1.1.0"
220
220
 
221
221
  include Enumerable
222
222
 
@@ -286,18 +286,10 @@ class Set
286
286
  @hash = orig.instance_variable_get(:@hash).dup
287
287
  end
288
288
 
289
- if Kernel.instance_method(:initialize_clone).arity != 1
290
- # Clone internal hash.
291
- def initialize_clone(orig, **options)
292
- super
293
- @hash = orig.instance_variable_get(:@hash).clone(**options)
294
- end
295
- else
296
- # Clone internal hash.
297
- def initialize_clone(orig)
298
- super
299
- @hash = orig.instance_variable_get(:@hash).clone
300
- end
289
+ # Clone internal hash.
290
+ def initialize_clone(orig, **options)
291
+ super
292
+ @hash = orig.instance_variable_get(:@hash).clone(**options)
301
293
  end
302
294
 
303
295
  def freeze # :nodoc:
@@ -389,7 +381,7 @@ class Set
389
381
  # Equivalent to Set#flatten, but replaces the receiver with the
390
382
  # result in place. Returns nil if no modifications were made.
391
383
  def flatten!
392
- replace(flatten()) if any? { |e| e.is_a?(Set) }
384
+ replace(flatten()) if any?(Set)
393
385
  end
394
386
 
395
387
  # Returns true if the set contains the given object.
@@ -409,7 +401,7 @@ class Set
409
401
  when set.instance_of?(self.class) && @hash.respond_to?(:>=)
410
402
  @hash >= set.instance_variable_get(:@hash)
411
403
  when set.is_a?(Set)
412
- size >= set.size && set.all? { |o| include?(o) }
404
+ size >= set.size && set.all?(self)
413
405
  else
414
406
  raise ArgumentError, "value must be a set"
415
407
  end
@@ -422,7 +414,7 @@ class Set
422
414
  when set.instance_of?(self.class) && @hash.respond_to?(:>)
423
415
  @hash > set.instance_variable_get(:@hash)
424
416
  when set.is_a?(Set)
425
- size > set.size && set.all? { |o| include?(o) }
417
+ size > set.size && set.all?(self)
426
418
  else
427
419
  raise ArgumentError, "value must be a set"
428
420
  end
@@ -435,7 +427,7 @@ class Set
435
427
  when set.instance_of?(self.class) && @hash.respond_to?(:<=)
436
428
  @hash <= set.instance_variable_get(:@hash)
437
429
  when set.is_a?(Set)
438
- size <= set.size && all? { |o| set.include?(o) }
430
+ size <= set.size && all?(set)
439
431
  else
440
432
  raise ArgumentError, "value must be a set"
441
433
  end
@@ -448,7 +440,7 @@ class Set
448
440
  when set.instance_of?(self.class) && @hash.respond_to?(:<)
449
441
  @hash < set.instance_variable_get(:@hash)
450
442
  when set.is_a?(Set)
451
- size < set.size && all? { |o| set.include?(o) }
443
+ size < set.size && all?(set)
452
444
  else
453
445
  raise ArgumentError, "value must be a set"
454
446
  end
@@ -479,12 +471,12 @@ class Set
479
471
  case set
480
472
  when Set
481
473
  if size < set.size
482
- any? { |o| set.include?(o) }
474
+ any?(set)
483
475
  else
484
- set.any? { |o| include?(o) }
476
+ set.any?(self)
485
477
  end
486
478
  when Enumerable
487
- set.any? { |o| include?(o) }
479
+ set.any?(self)
488
480
  else
489
481
  raise ArgumentError, "value must be enumerable"
490
482
  end
data/set.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.description = %q{Provides a class to deal with collections of unordered, unique values}
16
16
  spec.homepage = "https://github.com/ruby/set"
17
17
  spec.licenses = ["Ruby", "BSD-2-Clause"]
18
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
18
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
19
19
 
20
20
  spec.metadata["homepage_uri"] = spec.homepage
21
21
  spec.metadata["source_code_uri"] = spec.homepage
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: set
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-08 00:00:00.000000000 Z
11
+ date: 2023-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides a class to deal with collections of unordered, unique values
14
14
  email:
@@ -38,7 +38,7 @@ licenses:
38
38
  metadata:
39
39
  homepage_uri: https://github.com/ruby/set
40
40
  source_code_uri: https://github.com/ruby/set
41
- changelog_uri: https://github.com/ruby/set/blob/v1.0.4/CHANGELOG.md
41
+ changelog_uri: https://github.com/ruby/set/blob/v1.1.0/CHANGELOG.md
42
42
  post_install_message:
43
43
  rdoc_options: []
44
44
  require_paths:
@@ -47,7 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 2.7.0
50
+ version: 3.0.0
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="