backports 3.25.0 → 3.25.1
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/lib/backports/3.2.0/enumerator/product.rb +34 -3
- data/lib/backports/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36ede0c424a25b64633c443a48c716c2876ac448c5a34544c842f5a5710ff03c
|
4
|
+
data.tar.gz: c8d3d198e817f6dc9d37f21519d84e1252e53482969a6759e25774a16fec93e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5a36ace358abdf8dbce16371ee1f49c07d23373e537322f8079578e283d5e095ac06261b572b3574e88543148e4c1f5127204aecbfdbd817d7dcdef72574fcf
|
7
|
+
data.tar.gz: abe5101c680b15fe50d6743f7d5b702a3726a4b5c0b13c4e4d2474aa6f1d6f693557fcd74dad46a3b2b050628094fe668b23d73f7f005e74d99734891c8a5ee9
|
@@ -5,7 +5,14 @@ unless Enumerator.method_defined? :product
|
|
5
5
|
if kwargs && !kwargs.empty?
|
6
6
|
raise ArgumentError, "unknown keywords: #{kwargs.keys.map(&:inspect).join(', ')}"
|
7
7
|
end
|
8
|
-
Enumerator::Product.new(*enums)
|
8
|
+
product = Enumerator::Product.new(*enums)
|
9
|
+
|
10
|
+
if block_given?
|
11
|
+
product.each(&block)
|
12
|
+
return nil
|
13
|
+
end
|
14
|
+
|
15
|
+
product
|
9
16
|
end
|
10
17
|
EOT
|
11
18
|
else
|
@@ -14,7 +21,14 @@ unless Enumerator.method_defined? :product
|
|
14
21
|
if kwargs.is_a?(Hash) && !kwargs.empty?
|
15
22
|
raise ArgumentError, "unknown keywords: #{kwargs.keys.map(&:inspect).join(', ')}"
|
16
23
|
end
|
17
|
-
Enumerator::Product.new(*enums)
|
24
|
+
product = Enumerator::Product.new(*enums)
|
25
|
+
|
26
|
+
if block_given?
|
27
|
+
product.each(&block)
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
|
31
|
+
product
|
18
32
|
end
|
19
33
|
end
|
20
34
|
|
@@ -36,6 +50,7 @@ unless Enumerator.method_defined? :product
|
|
36
50
|
def each(&block)
|
37
51
|
return self unless block
|
38
52
|
__execute(block, [], @__enums)
|
53
|
+
self
|
39
54
|
end
|
40
55
|
|
41
56
|
def __execute(block, values, enums)
|
@@ -56,7 +71,7 @@ unless Enumerator.method_defined? :product
|
|
56
71
|
@__enums.each do |enum|
|
57
72
|
return nil unless enum.respond_to?(:size)
|
58
73
|
size = enum.size
|
59
|
-
return size if size == nil || size == Float::INFINITY || size ==
|
74
|
+
return size if size == 0 || size == nil || size == Float::INFINITY || size == -Float::INFINITY
|
60
75
|
return nil unless size.is_a?(Integer)
|
61
76
|
total_size *= size
|
62
77
|
end
|
@@ -69,5 +84,21 @@ unless Enumerator.method_defined? :product
|
|
69
84
|
end
|
70
85
|
self
|
71
86
|
end
|
87
|
+
|
88
|
+
private def initialize_copy(other)
|
89
|
+
return self if equal?(other)
|
90
|
+
|
91
|
+
raise TypeError unless Product === other
|
92
|
+
|
93
|
+
super(other)
|
94
|
+
|
95
|
+
other_enums = other.instance_variable_get(:@__enums)
|
96
|
+
|
97
|
+
raise ArgumentError, "uninitialized product" unless other_enums
|
98
|
+
|
99
|
+
@__enums = other_enums
|
100
|
+
|
101
|
+
self
|
102
|
+
end
|
72
103
|
end
|
73
104
|
end
|
data/lib/backports/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Backports
|
2
|
-
VERSION = "3.25.
|
2
|
+
VERSION = "3.25.1" unless Backports.constants.include? :VERSION # the guard is against a redefinition warning that happens on Travis
|
3
3
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.25.
|
4
|
+
version: 3.25.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-André Lafortune
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Essential backports that enable many of the nice features of Ruby for
|
14
14
|
earlier versions.
|
@@ -646,7 +646,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
646
646
|
- !ruby/object:Gem::Version
|
647
647
|
version: '0'
|
648
648
|
requirements: []
|
649
|
-
rubygems_version: 3.
|
649
|
+
rubygems_version: 3.5.11
|
650
650
|
signing_key:
|
651
651
|
specification_version: 4
|
652
652
|
summary: Backports of Ruby features for older Ruby.
|