ractorize 0.0.2 → 0.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/CHANGELOG.md +8 -0
- data/src/ractorize/ractorized_object.rb +12 -3
- data/src/ractorize/thunk.rb +4 -0
- data/src/ractorize.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4125b52255fca881ea212e46e55e4c795e79b39f8d8369580022e67db2eb9a8
|
|
4
|
+
data.tar.gz: 91f58df84879ac297d0111f5880faf8ea95804fdb4ae17345f7702e579fbfb42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 691e4eb2b5a1d436b366e93256e7af917308ea3ca3292205791023f92948202464279d4e11e3251c9d842ac63e79a1d5e1a3c377747e07ced9956722a67e2d68
|
|
7
|
+
data.tar.gz: ef0e4f07687797d2036f326674150ba9ff1e5e07a604936109f4ff0e0811bb19de85d22a5834c8684ed49860cc4f27943d3a292960378c46a2c661f561e91b05
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.0.3] - 2026-05-21
|
|
2
|
+
|
|
3
|
+
- Treat ==, !=, and ! as predicates and delegate them to the ractor (as well as #equal?)
|
|
4
|
+
- Don't wrap thunks in more thunks. Unwrap them in RACTOR_PROC which can help with Port#receive issues
|
|
5
|
+
- Send a frozen array to the ractor to avoid dup/clone
|
|
6
|
+
- Something somewhere in other projects calls Thunk#initialize_clone, so make a placeholder for it
|
|
7
|
+
- Do not bother moving shareable objects to the ractor, just send them
|
|
8
|
+
|
|
1
9
|
## [0.0.2] - 2026-05-18
|
|
2
10
|
|
|
3
11
|
- Make sure ractorized objects are shareable. This requires them to be unusable after closing (or joining) them.
|
|
@@ -8,7 +8,11 @@ module Ractorize
|
|
|
8
8
|
|
|
9
9
|
# It doesn't seem like we have a way to move the object into the ractor via its constructor so do
|
|
10
10
|
# it with #<< instead.
|
|
11
|
-
|
|
11
|
+
if ::Ractor.shareable?(outside_object)
|
|
12
|
+
@ractor << outside_object
|
|
13
|
+
else
|
|
14
|
+
@ractor.send(outside_object, move: true)
|
|
15
|
+
end
|
|
12
16
|
|
|
13
17
|
# Wow, this works! Scary?
|
|
14
18
|
::Object.instance_method(:freeze).bind(self).call
|
|
@@ -30,11 +34,11 @@ module Ractorize
|
|
|
30
34
|
|
|
31
35
|
return_port = ::Ractor::Port.new
|
|
32
36
|
|
|
33
|
-
@ractor << [method_name, args, opts, return_port]
|
|
37
|
+
@ractor << [method_name, args.dup.freeze, opts.dup.freeze, return_port].freeze
|
|
34
38
|
|
|
35
39
|
# Let's assume the user would rather block on all predicate methods than
|
|
36
40
|
# incorrectly get a non-truthy value (thunk is always truthy even if it evaluates as nil/false)
|
|
37
|
-
if method_name.end_with?("?")
|
|
41
|
+
if method_name == :== || method_name == :! || method_name == :!= || method_name.end_with?("?")
|
|
38
42
|
return_port.receive
|
|
39
43
|
else
|
|
40
44
|
Thunk.new(return_port)
|
|
@@ -53,5 +57,10 @@ module Ractorize
|
|
|
53
57
|
def respond_to_missing?(method_name, include_all = false)
|
|
54
58
|
method_missing(:respond_to?, method_name, include_all)
|
|
55
59
|
end
|
|
60
|
+
|
|
61
|
+
def ==(other) = method_missing(:==, other)
|
|
62
|
+
def !=(other) = method_missing(:==, other)
|
|
63
|
+
def ! = method_missing(:!)
|
|
64
|
+
def equal?(other) = method_missing(:equal?, other)
|
|
56
65
|
end
|
|
57
66
|
end
|
data/src/ractorize/thunk.rb
CHANGED
data/src/ractorize.rb
CHANGED