Skip to content

Commit 64bad43

Browse files
committed
Use the new Ractor#value method for Ruby >= 4.0.0 (closes #50).
* https://dev.to/ko1/ractorport-revamping-the-ractor-api-98
1 parent 3d00c0e commit 64bad43

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

spec/crc_examples.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,16 @@
6161

6262
if defined?(Ractor)
6363
it "should calculate CRC inside ractor" do
64-
digest = Ractor.new(described_class, string) { |klass, string|
64+
ractor = Ractor.new(described_class, string) do |klass, string|
6565
klass.hexdigest(string)
66-
}.take
66+
end
67+
68+
# NOTE: Ractor#take was replaced with Ractor#value in 4.0.0
69+
digest = if RUBY_VERSION >= '4.0.0'
70+
ractor.value
71+
else
72+
ractor.take
73+
end
6774

6875
expect(digest).to eq expected
6976
end

0 commit comments

Comments
 (0)