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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 259d8a0f04fdab353871748575089e83199cfad7d81440d4e6f3a957366c9301
4
- data.tar.gz: e05e67142fdd2c081ec6baf244df8f7dadf991437c12e7d27cc87c793c863956
3
+ metadata.gz: f4125b52255fca881ea212e46e55e4c795e79b39f8d8369580022e67db2eb9a8
4
+ data.tar.gz: 91f58df84879ac297d0111f5880faf8ea95804fdb4ae17345f7702e579fbfb42
5
5
  SHA512:
6
- metadata.gz: ebd8a74f6bd6040740c5d41adb81f4caba0508ec28f1025eedb8a2feef826f5f09d764535593d464d3355bebe64941138f5789c9792223df8fe095af7384d985
7
- data.tar.gz: 30b2f4d65a70d7218b5e3d76b1f6c04f3cb0c784fe8cd639d53770705caa61163c5c84ba678cd725f8f19296c1c6d985c6310ff461dbade04015522f96a8b155
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
- @ractor.<<(outside_object, move: true)
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
@@ -6,6 +6,10 @@ module Ractorize
6
6
  self.__return_value_port__ = return_value_port
7
7
  end
8
8
 
9
+ def initialize_clone(...)
10
+ # is this actually necessary?? Seems so?
11
+ end
12
+
9
13
  def method_missing(method_name, *)
10
14
  __value__.send(method_name, *)
11
15
  end
data/src/ractorize.rb CHANGED
@@ -19,6 +19,8 @@ module Ractorize
19
19
  else
20
20
  value = object.__send__(method_name, *method_args, **opts)
21
21
 
22
+ value = value.__value__ while Thunk === value
23
+
22
24
  return_port << value
23
25
  end
24
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ractorize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi