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 +4 -4
- data/.github/workflows/test.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/set.rb +13 -21
- data/set.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef560e603f6d6413751c31bb94fddf3838a66af8e71cff73c74760ff479ff6a
|
4
|
+
data.tar.gz: 448e22e93eebe57b26200fc1c8be476d60494193136aabb09a50c68e878e96cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91fa3052d7f25eaf6c0066013a5bd2d0c58961fe330c8923853634bac908ae83323d01b26ec8f85c4ab1ae309a83cc8e30e0918802ebb6f96fc3fcb7b7bdd433
|
7
|
+
data.tar.gz: 07b57081279057d476e1fe7c07587db1de0243cb78d36bc04b5b3ed303643b54320f08e98ed3672e610df84c42f0d503c7fae7eba040d2cf260c84319e7f9745
|
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
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
|
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
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
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?
|
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?
|
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?
|
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?
|
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?
|
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?
|
474
|
+
any?(set)
|
483
475
|
else
|
484
|
-
set.any?
|
476
|
+
set.any?(self)
|
485
477
|
end
|
486
478
|
when Enumerable
|
487
|
-
set.any?
|
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(">=
|
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
|
+
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-
|
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
|
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:
|
50
|
+
version: 3.0.0
|
51
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|